Author njs
Recipients njs
Date 2014-04-15.08:55:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1397552161.67.0.235704351339.issue21233@psf.upfronthosting.co.za>
In-reply-to
Content
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().
  https://docs.python.org/3.5/c-api/memory.html#c.PyMemAllocator

So, we should add *Calloc variants. This met general approval on python-dev. Thread here:
  https://mail.python.org/pipermail/python-dev/2014-April/133985.html

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.
History
Date User Action Args
2014-04-15 08:56:01njssetrecipients: + njs
2014-04-15 08:56:01njssetmessageid: <1397552161.67.0.235704351339.issue21233@psf.upfronthosting.co.za>
2014-04-15 08:56:01njslinkissue21233 messages
2014-04-15 08:55:59njscreate