Author jlaurila
Recipients jlaurila
Date 2008-07-09.19:48:50
SpamBayes Score 0.000844214
Marked as misclassified No
Message-id <1215632933.18.0.0332019532518.issue3329@psf.upfronthosting.co.za>
In-reply-to
Content
Currently Python always uses the C library malloc/realloc/free as the
underlying mechanism for requesting memory from the OS, but especially
on memory-limited platforms it is often desirable to be able to override
the allocator and to redirect all Python's allocations to use a special
heap. This will make it possible to free memory back to the operating
system without restarting the process, and to reduce fragmentation by
separating Python's allocations from the rest of the program.

The proposal is to make it possible to set the allocator used by the
Python interpreter by calling the following function before Py_Initialize():

void Py_SetAllocator(void* (*alloc)(size_t), void* (*realloc)(void*,
size_t), void (*free)(void*))

Direct function calls to malloc/realloc/free in obmalloc.c must be
replaced with calls through the function pointers set through this
function. By default these would of course point to the C stdlib
malloc/realloc/free.
History
Date User Action Args
2008-07-09 19:48:53jlaurilasetspambayes_score: 0.000844214 -> 0.000844214
recipients: + jlaurila
2008-07-09 19:48:53jlaurilasetspambayes_score: 0.000844214 -> 0.000844214
messageid: <1215632933.18.0.0332019532518.issue3329@psf.upfronthosting.co.za>
2008-07-09 19:48:51jlaurilalinkissue3329 messages
2008-07-09 19:48:50jlaurilacreate