mirror of
				https://github.com/python/cpython.git
				synced 2025-10-25 10:44:55 +00:00 
			
		
		
		
	 5716cc3529
			
		
	
	
		5716cc3529
		
			
		
	
	
	
	
		
			
			This combines and updates our freelist handling to use a consistent implementation. Objects in the freelist are linked together using the first word of memory block. If configured with freelists disabled, these operations are essentially no-ops.
		
			
				
	
	
		
			17 lines
		
	
	
	
		
			488 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			17 lines
		
	
	
	
		
			488 B
		
	
	
	
		
			C
		
	
	
	
	
	
| #include "Python.h"
 | |
| #include "pycore_freelist.h"   // _PyObject_ClearFreeLists()
 | |
| 
 | |
| #ifndef Py_GIL_DISABLED
 | |
| 
 | |
| /* Clear all free lists
 | |
|  * All free lists are cleared during the collection of the highest generation.
 | |
|  * Allocated items in the free list may keep a pymalloc arena occupied.
 | |
|  * Clearing the free lists may give back memory to the OS earlier.
 | |
|  */
 | |
| void
 | |
| _PyGC_ClearAllFreeLists(PyInterpreterState *interp)
 | |
| {
 | |
|     _PyObject_ClearFreeLists(&interp->object_state.freelists, 0);
 | |
| }
 | |
| 
 | |
| #endif
 |