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 <1371201150.88.0.894777642892.issue18203@psf.upfronthosting.co.za>
In-reply-to
Content
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 */
#define CCPMEM_PATCH_RAW
#include "ccpmem_patch.h"
History
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: <1371201150.88.0.894777642892.issue18203@psf.upfronthosting.co.za>
2013-06-14 09:12:30kristjan.jonssonlinkissue18203 messages
2013-06-14 09:12:30kristjan.jonssoncreate