[Python-Dev] RFC: PEP 445: Add new APIs to customize Python memory allocators

Victor Stinner victor.stinner at gmail.com
Wed Jun 19 17:58:36 CEST 2013


2013/6/19 Kristján Valur Jónsson <kristjan at ccpgames.com>:
> Oh, it should be public, in my opinion.

Ok. And do you think that the PyMemMappingAllocator structure is
complete, or that we should add something to be future-proof? At
least, PyMemMappingAllocator is enough for pymalloc usage :-)

Is PyMemMappingAllocator complete enough for your usage at CCP Games?

> We do exactly that when we embed python into UnrealEngine.  We keep pythons internal PyObject_Mem allocator, but have it ask UnrealEngine for its arenas.  That way, we can still keep track of python's memory usage from with the larger application, even if the granularity of memory is now on an "arena" level, rather than individual allocs.

I hope that the PEP 445 is flexible enough to allow you to decide
which functions are hooked and replaced, and which functions will be
leaved unchanged. That's why I'm not in favor of the "Make
PyMem_Malloc() reuse PyMem_RawMalloc() by default" alternative.

Victor


More information about the Python-Dev mailing list