[Python-Dev] valgrind

Kristján V. Jónsson kristjan at ccpgames.com
Tue Nov 7 15:05:14 CET 2006

You want to disable the obmalloc module when using valgrind, as I have when using Rational Purify.
obmalloc does some evil stuff to recocnize its memory.
You also want to disable it so that you get verification on a per-block level.

Actually, obmalloc could be improved in this aspect.  Similar code that I once wrote
computed the block base address, but than looked in its tables to see if it was actually
a known block before accessing it.  That way you can have blocks that are larger than
the virtual memory block of the process.


> -----Original Message-----
> From: python-dev-bounces+kristjan=ccpgames.com at python.org 
> [mailto:python-dev-bounces+kristjan=ccpgames.com at python.org] 
> On Behalf Of Herman Geza
> Sent: 7. nóvember 2006 02:12
> To: python-dev at python.org
> Subject: [Python-Dev] valgrind
> Hi!
> I've embedded python into my application. Using valgrind I 
> got a lot of errors. I understand that "Conditional jump or 
> move depends on uninitialised value(s)" errors are completely 
> ok (from Misc/README.valgrind). However, I don't understand 
> why "Invalid read"'s are legal, like this:
> ==21737== Invalid read of size 4
> ==21737==    at 0x408DDDF: PyObject_Free (in 
> /usr/lib/libpython2.4.so.1.0)
> ==21737==    by 0x4096F67: (within /usr/lib/libpython2.4.so.1.0)
> ==21737==    by 0x408A5AC: PyCFunction_Call (in 
> /usr/lib/libpython2.4.so.1.0)
> ==21737==    by 0x40C65F8: PyEval_EvalFrame (in 
> /usr/lib/libpython2.4.so.1.0)
> ==21737==  Address 0xC02E010 is 32 bytes inside a block of 
> size 40 free'd
> ==21737==    at 0x401D139: free (vg_replace_malloc.c:233)
> ==21737==    by 0x408DE00: PyObject_Free (in 
> /usr/lib/libpython2.4.so.1.0)
> ==21737==    by 0x407BB4D: (within /usr/lib/libpython2.4.so.1.0)
> ==21737==    by 0x407A3D6: (within /usr/lib/libpython2.4.so.1.0)
> Here python reads from an already-freed memory area, right? 
> (I don't think that Misc/README.valgrind answers this 
> question). Or is it a false alarm?
> Thanks,
> Geza Herman
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: 
> http://mail.python.org/mailman/options/python-dev/kristjan%40c

More information about the Python-Dev mailing list