This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients rhettinger, serhiy.storchaka, vstinner
Date 2015-09-25.09:03:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1443171805.85.0.357110562053.issue25135@psf.upfronthosting.co.za>
In-reply-to
Content
"Victor, I was thinking of switching to PyMem_RawMalloc instead of PyMem_Malloc.  The advantages are that there are guaranteed to be no side-effects, the GIL doesn't need to be held, and there is less overhead.  Are there any disadvantage I should know about?"

For me, PyMem_Malloc() can be faster than PyMem_RawMalloc() because the GIL is held. In practice... both function are very thin wrapper to malloc(), so it's exactly the same :-) In Objects/obmalloc.c, you have:

#define PYRAW_FUNCS _PyMem_RawMalloc, _PyMem_RawCalloc, _PyMem_RawRealloc, _PyMem_RawFree
...
#define PYMEM_FUNCS PYRAW_FUNCS

So PyMem_Malloc() and PyMem_RawMalloc() are *currently* exactly the same.

I'm not sure that you understand what you are trying to do. If you expect better performances, you should try to use PyObject_Malloc() instead, to benefit from the fast Python allocator for small allocations (512 bytes and less).
History
Date User Action Args
2015-09-25 09:03:25vstinnersetrecipients: + vstinner, rhettinger, serhiy.storchaka
2015-09-25 09:03:25vstinnersetmessageid: <1443171805.85.0.357110562053.issue25135@psf.upfronthosting.co.za>
2015-09-25 09:03:25vstinnerlinkissue25135 messages
2015-09-25 09:03:25vstinnercreate