Author njs
Recipients njs
Date 2014-04-15.08:55:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Numpy would like to switch to using the CPython allocator interface in order to take advantage of the new tracemalloc infrastructure in 3.4. But, numpy relies on the availability of calloc(), and the CPython allocator API does not expose calloc().

So, we should add *Calloc variants. This met general approval on python-dev. Thread here:

This would involve adding a new .calloc field to the PyMemAllocator struct, exposed through new API functions PyMem_RawCalloc, PyMem_Calloc, PyObject_Calloc. [It's not clear that all 3 would really be used, but since we have only one PyMemAllocator struct that they all share, it'd be hard to add support to only one or two of these domains and not the rest. And the higher-level calloc variants might well be used. Numpy array buffers are often small (e.g., holding only a single value), and these small buffers benefit from small-alloc optimizations; meanwhile, large buffers benefit from calloc optimizations. So it might be optimal to use a single allocator that has both.]

We might also have to rename the PyMemAllocator struct to ensure that compiling old code with the new headers doesn't silently leave garbage in the .calloc field and lead to crashes.
Date User Action Args
2014-04-15 08:56:01njssetrecipients: + njs
2014-04-15 08:56:01njssetmessageid: <>
2014-04-15 08:56:01njslinkissue21233 messages
2014-04-15 08:55:59njscreate