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.

classification
Title: valgrind detects problems in PyObject_Free
Type: Stage:
Components: Interpreter Core Versions: Python 2.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: nnorwitz Nosy List: jtajta2002, nnorwitz
Priority: normal Keywords:

Created on 2006-04-19 14:12 by jtajta2002, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg28310 - (view) Author: Jaime Torres Amate (jtajta2002) Date: 2006-04-19 14:12
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.
msg28311 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-04-21 03:59
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.
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43251
2006-04-19 14:12:46jtajta2002create