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 kristjan.jonsson
Recipients amaury.forgeotdarc, christian.heimes, georg.brandl, kristjan.jonsson, ncoghlan, serhiy.storchaka, vstinner
Date 2013-06-14.09:12:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Keeping the GIL requirement is _very_ useful for PyMem_MALLOC et al.  It allows applications to hook in their own monitoring code, accessible from python itself, without having to worry about conflicts with python.
even if it were not for the GIL itself, PyMem_Malloc() may have all sorts of side effects.

Because of this, and to allow ourselves the flexibility to do all sorts of things inside PyMem_Malloc(), at CCP we added a parallel api, PyMem_MALLOC_RAW() etc.
This api is guaranteed to delegate directly to the external allocator (malloc by default, or an embedding application's supplied allocastor)

We have patched pythoncore in 2.7 in all places there were using malloc directly using the file attached to the defect.  Notice how it can patch "malloc" in two different ways, using either regular malloc (in non-sensitive areas) and using the raw malloc (in sensitive areas.)

e.g. thread.c contains the following lines in our branch:
#include "Python.h"

/* patch malloc/free with threadsafe python versions */
#include "ccpmem_patch.h"
Date User Action Args
2013-06-14 09:12:30kristjan.jonssonsetrecipients: + kristjan.jonsson, georg.brandl, amaury.forgeotdarc, ncoghlan, vstinner, christian.heimes, serhiy.storchaka
2013-06-14 09:12:30kristjan.jonssonsetmessageid: <>
2013-06-14 09:12:30kristjan.jonssonlinkissue18203 messages
2013-06-14 09:12:30kristjan.jonssoncreate