[ python-Bugs-1473000 ] valgrind detects problems in PyObject_Free

SourceForge.net noreply at sourceforge.net
Fri Apr 21 05:59:32 CEST 2006


Bugs item #1473000, was opened at 2006-04-19 07:12
Message generated for change (Comment added) made by nnorwitz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1473000&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.4
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Jaime Torres Amate (jtajta2002)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: valgrind detects problems in PyObject_Free

Initial Comment:
I just compiled python 2.4.3 with gcc 4.1.0, using
glibc-2.4, and the COPTS = -g -O2

I just run valgrind (version 3.1.1) python -v
And I get a lot of errors complaying about PyObject_Free:

Conditional jump or move depends on uninitialised value(s)
    at 0x40B66A4: PyObject_Free (obmalloc.c:735)
    by 0x40B1E71: dictresize (dictobject.c:495)
    by 0x40B204D: PyDict_SetItemString (dictobject.c:1988)
    by 0x41048E3: Py_InitModule4 (modsupport.c:82)
    by 0x4116364: initposix (posixmodule.c:7895)
    by 0x40FF281: init_builtin (import.c:1765)
    by 0x40FF511: load_module (import.c:1694)
    by 0x40FFB3F: import_submodule (import.c:2266)
    by 0x40FFFEE: load_next (import.c:2086)
    by 0x41001D6: PyImport_ImportModuleEx (import.c:1921)
    by 0x40E23AD: builtin___import__ (bltinmodule.c:45)
    by 0x40B2FCC: PyCFunction_Call (methodobject.c:108)
------------------------
Invalid read of size 4
    at 0x40B669F: PyObject_Free (obmalloc.c:735)
    by 0x4103B7E: PyMarshal_ReadLastObjectFromFile
(marshal.c:768)
    by 0x40FCE53: read_compiled_module (import.c:723)
    by 0x40FED89: load_source_module (import.c:891)
    by 0x40FFB3F: import_submodule (import.c:2266)
    by 0x40FFFEE: load_next (import.c:2086)
    by 0x41001D6: PyImport_ImportModuleEx (import.c:1921)
    by 0x40E23AD: builtin___import__ (bltinmodule.c:45)
    by 0x40B2FCC: PyCFunction_Call (methodobject.c:108)
    by 0x408BB36: PyObject_Call (abstract.c:1795)
    by 0x40E580A: PyEval_CallObjectWithKeywords
(ceval.c:3430)
    by 0x40E87D1: PyEval_EvalFrame (ceval.c:2020)
  Address 0x4339010 is 232 bytes inside a block of size
352 free'd
    at 0x4022E9D: free (vg_replace_malloc.c:235)
    by 0x41FBD1B: __fopen_internal (in /lib/libc-2.4.so)
    by 0x41FE569: fopen64 (in /lib/libc-2.4.so)
    by 0x40FD626: find_module (import.c:1316)
    by 0x40FFC64: import_submodule (import.c:2256)
    by 0x40FFFEE: load_next (import.c:2086)
    by 0x41001D6: PyImport_ImportModuleEx (import.c:1921)
    by 0x40E23AD: builtin___import__ (bltinmodule.c:45)
    by 0x40B2FCC: PyCFunction_Call (methodobject.c:108)
    by 0x408BB36: PyObject_Call (abstract.c:1795)
    by 0x40E580A: PyEval_CallObjectWithKeywords
(ceval.c:3430)
    by 0x40E87D1: PyEval_EvalFrame (ceval.c:2020)
---------------------

 Invalid read of size 4
    at 0x40B669F: PyObject_Free (obmalloc.c:735)
    by 0x4085A12: PyGrammar_RemoveAccelerators
(acceler.c:47)
    by 0x41070DC: Py_Finalize (pythonrun.c:436)
    by 0x410E2C4: Py_Main (main.c:513)
    by 0x8048559: main (in /usr/bin/python)
  Address 0x4364010 is 104 bytes inside a block of size
640 free'd
    at 0x4022E9D: free (vg_replace_malloc.c:235)
    by 0x40B66C0: PyObject_Free (obmalloc.c:798)
    by 0x4085BA1: PyGrammar_AddAccelerators (acceler.c:124)
    by 0x40866A7: PyParser_New (parser.c:77)
    by 0x4086722: parsetok (parsetok.c:109)
    by 0x4086C9E: PyParser_ParseStringFlags (parsetok.c:31)
    by 0x4105FF3: PyParser_SimpleParseStringFlags
(pythonrun.c:1365)
    by 0x410644A: PyRun_StringFlags (pythonrun.c:1222)
    by 0x40E1CBA: builtin_eval (bltinmodule.c:527)
    by 0x40B2FCC: PyCFunction_Call (methodobject.c:108)
    by 0x40EAE9B: PyEval_EvalFrame (ceval.c:3563)
    by 0x40EA6AA: PyEval_EvalFrame (ceval.c:3645)


--------------

ERROR SUMMARY: 9678 errors from 111 contexts
(suppressed: 36 from 1)
malloc/free: in use at exit: 715,180 bytes in 251 blocks.
malloc/free: 1,822 allocs, 1,571 frees, 1,552,763 bytes
allocated.
For counts of detected errors, rerun with: -v
searching for pointers to 251 not-freed blocks.
checked 664,740 bytes.

LEAK SUMMARY:
    definitely lost: 10 bytes in 2 blocks.
      possibly lost: 0 bytes in 0 blocks.
    still reachable: 715,170 bytes in 249 blocks.
         suppressed: 0 bytes in 0 blocks.


Best regards and many thanks for such an incredible
language.

----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2006-04-20 20:59

Message:
Logged In: YES 
user_id=33168

Please read this file: 
http://svn.python.org/projects/python/branches/release24-maint/Misc/README.valgrind

That should explain what's going on and how to fix it.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1473000&group_id=5470


More information about the Python-bugs-list mailing list