mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	
		
			
	
	
		
			20 lines
		
	
	
	
		
			503 B
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			20 lines
		
	
	
	
		
			503 B
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								#include "Python.h"
							 | 
						||
| 
								 | 
							
								#include "pycore_pystate.h"   // _Py_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)
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    _PyDict_ClearFreeList(interp);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    _Py_ClearFreeLists(&interp->freelist_state, 0);
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif
							 |