[Python-Dev] RFC: PEP 445: Add new APIs to customize Python memory allocators (original) (raw)
Antoine Pitrou solipsis at pitrou.net
Wed Jun 19 16:15:58 CEST 2013
- Previous message: [Python-Dev] RFC: PEP 445: Add new APIs to customize Python memory allocators
- Next message: [Python-Dev] RFC: PEP 445: Add new APIs to customize Python memory allocators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Le Tue, 18 Jun 2013 22:40:49 +0200, Victor Stinner <victor.stinner at gmail.com> a écrit :
Other changes ------------- [...] * Configure external libraries like zlib or OpenSSL to allocate memory using
PyMemRawMalloc()
Why so, and is it done by default?
Only one get/set function for block allocators ----------------------------------------------
Replace the 6 functions: *
void PyMemGetRawAllocator(PyMemBlockAllocator *allocator)
*void PyMemGetAllocator(PyMemBlockAllocator *allocator)
*void PyObjectGetAllocator(PyMemBlockAllocator *allocator)
*void PyMemSetRawAllocator(PyMemBlockAllocator *allocator)
*void PyMemSetAllocator(PyMemBlockAllocator *allocator)
*void PyObjectSetAllocator(PyMemBlockAllocator *allocator)
with 2 functions with an additional domain argument: * ``int PyMemGetBlockAllocator(int domain, PyMemBlockAllocator *allocator)`` * ``int PyMemSetBlockAllocator(int domain, PyMemBlockAllocator *allocator)``
I would much prefer this solution.
Drawback: the caller has to check if the result is 0, or handle the error.
Or you can just call Py_FatalError() if the domain is invalid.
If an hook is used to the track memory usage, the
malloc()
memory will not be seen. Remainingmalloc()
may allocate a lot of memory and so would be missed in reports.
A lot of memory? In main()?
Regards
Antoine.
- Previous message: [Python-Dev] RFC: PEP 445: Add new APIs to customize Python memory allocators
- Next message: [Python-Dev] RFC: PEP 445: Add new APIs to customize Python memory allocators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]