[Python-Dev] Add calloc-like memory allocators to Python
Victor Stinner
victor.stinner at gmail.com
Mon Apr 28 11:08:25 CEST 2014
Hi,
We made progress on the following issue and the latest patch
(calloc-5.patch) is ready for a review:
http://bugs.python.org/issue21233
This issue should help numpy to reuse Python memory allocators to use
the new tracemalloc module of Python 3.4. The issue is only for Python
3.5.
It was also discussed that numpy might require a memory allocator with
a specified alignment for SIMD instructions. This topic is discussed
in a different issue:
http://bugs.python.org/issue18835
Summary of calloc-5.patch:
- add the following functions:
* void* PyMem_RawCalloc(size_t nelem, size_t elsize)
* void* PyMem_Calloc(size_t nelem, size_t elsize)
* void* PyObject_Calloc(size_t nelem, size_t elsize)
* PyObject* _PyObject_GC_Calloc(size_t basicsize)
- add "void* calloc(void *ctx, size_t nelem, size_t elsize)" field to
the PyMemAllocator structure
- optimize bytes(n) and bytearray(n) to allocate objects using
calloc() instead of malloc()
- update tracemalloc to trace also calloc()
- document new functions and add unit tests for the calloc "hook" (in _testcapi)
Victor
More information about the Python-Dev
mailing list