[EMAIL PROTECTED] wrote: > Is there any way to get Python to release memory back to the > C allocator? I'm currently running a script that goes through > the following steps: > > 1) Creates a very large number of Python objects to produce > a relatively small data structure that sits in a C extension. > The Python objects consume quite a bit of memory. > > 2) Releases all the Python objects. > > 3) Invokes a function of said C extension for further > processing. This step needs as much memory as possible. > > I'd like step 2 to return memory to the C allocator so that it > is available to the extension in step 3 (which uses malloc). >
Huh-uh. Other way up is better. If you have access to the source of the extension, change it so that it uses PyMem_Malloc, PyMem_Free, etc Read this; it tells you why: http://docs.python.org/api/memoryOverview.html Cheers, John -- http://mail.python.org/mailman/listinfo/python-list