PEP 445: Add new APIs to customize Python memory allocators (second round)
Hi, I changed the PEP 445 according to the discussing on python-dev. Read it online: http://www.python.org/dev/peps/pep-0445/ Changes: * add PyMemAllocatorDomain enum: PYALLOC_PYMEM_RAW, PYALLOC_PYMEM or PYALLOC_PYOBJECT * rename: - PyMemBlockAllocator structure => PyMemAllocator - PyMemMappingAllocator structure => PyObjectArenaAllocator - PyMem_GetMappingAllocator() => PyObject_GetArenaAllocator() - PyMem_SetMappingAllocator() => PyObject_SetArenaAllocator() * group get/set functions to only keep 2 functions: PyMem_GetAllocator() and PyMem_SetAllocator() * PyMem_RawMalloc(0) now calls malloc(1) to have a well defined behaviour * PYALLOC_PYMEM_RAW and PYALLOC_PYMEM are now using exactly the same allocator * Add more references for external libraries As expected, most changes occurred in the Proposal section. Full diff: http://hg.python.org/peps/rev/a17ebebe52ca I also updated the implementation attached to: http://bugs.python.org/issue3329 Who is going give the final decision on this PEP? Guido? Another candidate? Victor
I also updated the implementation attached to: http://bugs.python.org/issue3329
I excluded new enums, structures and functions from the stable ABI, except PyMem_Raw*() functions. Victor
Le Thu, 20 Jun 2013 13:26:52 +0200,
Victor Stinner
Hi,
I changed the PEP 445 according to the discussing on python-dev.
Read it online: http://www.python.org/dev/peps/pep-0445/
Changes:
* add PyMemAllocatorDomain enum: PYALLOC_PYMEM_RAW, PYALLOC_PYMEM or PYALLOC_PYOBJECT
PYMEM_DOMAIN_RAW?
* rename:
- PyMemBlockAllocator structure => PyMemAllocator - PyMemMappingAllocator structure => PyObjectArenaAllocator - PyMem_GetMappingAllocator() => PyObject_GetArenaAllocator() - PyMem_SetMappingAllocator() => PyObject_SetArenaAllocator()
* group get/set functions to only keep 2 functions: PyMem_GetAllocator() and PyMem_SetAllocator() * PyMem_RawMalloc(0) now calls malloc(1) to have a well defined behaviour * PYALLOC_PYMEM_RAW and PYALLOC_PYMEM are now using exactly the same allocator * Add more references for external libraries
As expected, most changes occurred in the Proposal section.
Full diff: http://hg.python.org/peps/rev/a17ebebe52ca
I also updated the implementation attached to: http://bugs.python.org/issue3329
Who is going give the final decision on this PEP? Guido? Another candidate?
Victor
On 20 June 2013 22:16, Antoine Pitrou
Le Thu, 20 Jun 2013 13:26:52 +0200, Victor Stinner
a écrit : Hi,
I changed the PEP 445 according to the discussing on python-dev.
Read it online: http://www.python.org/dev/peps/pep-0445/
Changes:
* add PyMemAllocatorDomain enum: PYALLOC_PYMEM_RAW, PYALLOC_PYMEM or PYALLOC_PYOBJECT
PYMEM_DOMAIN_RAW?
The challenge there is coming up with a good name for PYALLOC_PYMEM. I think Victor's names for the domains work well: - "PYALLOC_" prefix to say "this is an allocation domain" - "PYMEM_RAW" suffix for PyMem_RawMalloc/Realloc/Free - "PYMEM" suffix for PyMem_Malloc/Realloc/Free - "PYOBJECT" suffix for PyObject_Malloc/Realloc/Free Although, there's a copy-and-paste error in the domain definitions (2 *Reallocs in each entry and no *Frees). If Guido doesn't want to do it, I'm happy to. Antoine would be a good choice too, since he's the one who suggested taking the time to thrash out the API details in a PEP (which I agree has substantially improved the end result). Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
2013/6/20 Antoine Pitrou
Victor Stinner
javascript:;> a écrit : Changes:
* add PyMemAllocatorDomain enum: PYALLOC_PYMEM_RAW, PYALLOC_PYMEM or PYALLOC_PYOBJECT
PYMEM_DOMAIN_RAW?
I prefer your suggestion because it shares the PYMEM/PyMem prefix with PyMem_SetAllocator(). So the whole list would be: - PYMEM_DOMAIN_RAW - PYMEM_DOMAIN_MEM - PYMEM_DOMAIN_OBJ Victor
participants (3)
-
Antoine Pitrou
-
Nick Coghlan
-
Victor Stinner