[Python-Dev] head crashing (was: Fwd: [Python-checkins] buildbot warnings in x86 mvlgcc trunk) (original) (raw)
Brett Cannon brett at python.org
Tue May 1 20:17:53 CEST 2007
- Previous message: [Python-Dev] head crashing (was: Fwd: [Python-checkins] buildbot warnings in x86 mvlgcc trunk)
- Next message: [Python-Dev] head crashing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 5/1/07, Neal Norwitz <nnorwitz at gmail.com> wrote:
In rev 54982 (the first time this crash was seen), I see something which might create a problem. In python/trunk/Modules/posixmodule.c (near line 6300): + PyMemFREE(mode); PyENDALLOWTHREADS
The PyMem_MALLOC call that creates 'mode' is also called without explicitly holding the GIL.
Can you call PyMem_FREE() without the GIL held? I couldn't find it
documented either way.
I believe the GIL does not need to be held, but obviously Tim or someone with more memory experience should step in to say definitively.
If you look at Include/pymem.h, PyMem_FREE gets defined as PyObject_FREE in a debug build. PyObject_Free is defined at _PyObject_DebugFree. That function checks that the memory has not been written with the debug bit pattern and then calls PyObject_Free. That call just sticks the memory back into pymalloc's memory pool which is implemented without using any Python objects.
In other words no Python objects are used in pymalloc (to my knowledge) and thus is safe to use without the GIL.
-Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20070501/c62dbbf6/attachment.htm
- Previous message: [Python-Dev] head crashing (was: Fwd: [Python-checkins] buildbot warnings in x86 mvlgcc trunk)
- Next message: [Python-Dev] head crashing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]