[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: python bindings leak memory (Re: 1.7.0-beta1 up for testing)

From: rupert.thurner <rupert.thurner_at_gmail.com>
Date: Mon, 18 Jul 2011 01:15:54 -0700 (PDT)

On Jul 17, 8:04 pm, "rupert.thurner" <rupert.thur..._at_gmail.com> wrote:
> On Jul 17, 9:54 am, Philip Martin <philip.mar..._at_wandisco.com> wrote:
>
> > "rupert.thurner" <rupert.thur..._at_gmail.com> writes:
> > > it seems that the python bindings leak memory, and there seems no test
> > > covering this?
>
> > It's possible.  Please provide more details.
>
> the problem seems to be in svn_ra_replay and/or svn_ra_get_log. what i
> tried to do is:
>     python svnmem.py
>     valgrind python svnmem.py

i am not really sure how to debug this correctly. using valgrind for
mercurials hgsubversion, also using log and replay, it ends up with
500 MB of allocated memory after retrieving 5000 revisions:

$ valgrind --track-origins=yes hg clone svn://gcc.gnu.org/svn/gcc
....
[r5381] rms: [CROSS_COMPILE]: Include mips/a.out.h.
[r5382] rms: (ENQUIRE, CROSS_TEST): New variables.
[r5383] rms: (L_bb): Test inhibit_libc.
[r5384] rms: Comment change.
[r5385] rms: (INIT_CUMULATIVE_ARGS): Pass just the return value type
to aggregate_value_p.
[r5386] bson: Initial revision
[r5387] bson: added declaration for `trampoline' bytecode segment.
^Cpulled 5385 revisions
updating to branch default
557 files updated, 0 files merged, 0 files removed, 0 files
unresolved
==15203== Invalid read of size 4
==15203== at 0x80C1316: PyObject_Free (in /usr/bin/python2.7)
==15203== by 0x80CEF97: ??? (in /usr/bin/python2.7)
==15203== by 0x80BE3C5: PyDict_Clear (in /usr/bin/python2.7)
==15203== by 0x80BE3E0: ??? (in /usr/bin/python2.7)
==15203== by 0x80F2833: ??? (in /usr/bin/python2.7)
==15203== by 0x8074B53: PyGC_Collect (in /usr/bin/python2.7)
==15203== by 0x8070F49: Py_Finalize (in /usr/bin/python2.7)
==15203== by 0x8070368: Py_Exit (in /usr/bin/python2.7)
==15203== by 0x80704CB: ??? (in /usr/bin/python2.7)
==15203== by 0x80704F1: PyErr_PrintEx (in /usr/bin/python2.7)
==15203== by 0x80707B2: PyErr_Print (in /usr/bin/python2.7)
==15203== by 0x8070B01: PyRun_SimpleFileExFlags (in /usr/bin/
python2.7)
==15203== Address 0x51f7010 is 1,392 bytes inside a block of size
1,536 free'd
==15203== at 0x4025BF0: free (vg_replace_malloc.c:366)
==15203== by 0x80BE3E0: ??? (in /usr/bin/python2.7)
==15203== by 0x80F2833: ??? (in /usr/bin/python2.7)
==15203== by 0x8074B53: PyGC_Collect (in /usr/bin/python2.7)
==15203== by 0x8070F49: Py_Finalize (in /usr/bin/python2.7)
==15203== by 0x8070368: Py_Exit (in /usr/bin/python2.7)
==15203== by 0x80704CB: ??? (in /usr/bin/python2.7)
==15203== by 0x80704F1: PyErr_PrintEx (in /usr/bin/python2.7)
==15203== by 0x80707B2: PyErr_Print (in /usr/bin/python2.7)
==15203== by 0x8070B01: PyRun_SimpleFileExFlags (in /usr/bin/
python2.7)
==15203== by 0x805C068: Py_Main (in /usr/bin/python2.7)
==15203== by 0x805B25A: main (in /usr/bin/python2.7)
==15203==
==15203== Invalid read of size 4
==15203== at 0x80C1316: PyObject_Free (in /usr/bin/python2.7)
==15203== by 0x8105E2D: ??? (in /usr/bin/python2.7)
==15203== by 0x80BD444: ??? (in /usr/bin/python2.7)
==15203== by 0x80BDCAC: PyDict_SetItem (in /usr/bin/python2.7)
==15203== by 0x80BEB36: _PyModule_Clear (in /usr/bin/python2.7)
==15203== by 0x81395BA: PyImport_Cleanup (in /usr/bin/python2.7)
==15203== by 0x8070F4E: Py_Finalize (in /usr/bin/python2.7)
==15203== by 0x8070368: Py_Exit (in /usr/bin/python2.7)
==15203== by 0x80704CB: ??? (in /usr/bin/python2.7)
==15203== by 0x80704F1: PyErr_PrintEx (in /usr/bin/python2.7)
==15203== by 0x80707B2: PyErr_Print (in /usr/bin/python2.7)
==15203== by 0x8070B01: PyRun_SimpleFileExFlags (in /usr/bin/
python2.7)
==15203== Address 0x44ce010 is not stack'd, malloc'd or (recently)
free'd
==15203==
==15203== Invalid read of size 4
==15203== at 0x80C1316: PyObject_Free (in /usr/bin/python2.7)
==15203== by 0x80BD444: ??? (in /usr/bin/python2.7)
==15203== by 0x80BDCAC: PyDict_SetItem (in /usr/bin/python2.7)
==15203== by 0x80BEB36: _PyModule_Clear (in /usr/bin/python2.7)
==15203== by 0x81396A8: PyImport_Cleanup (in /usr/bin/python2.7)
==15203== by 0x8070F4E: Py_Finalize (in /usr/bin/python2.7)
==15203== by 0x8070368: Py_Exit (in /usr/bin/python2.7)
==15203== by 0x80704CB: ??? (in /usr/bin/python2.7)
==15203== by 0x80704F1: PyErr_PrintEx (in /usr/bin/python2.7)
==15203== by 0x80707B2: PyErr_Print (in /usr/bin/python2.7)
==15203== by 0x8070B01: PyRun_SimpleFileExFlags (in /usr/bin/
python2.7)
==15203== by 0x805C068: Py_Main (in /usr/bin/python2.7)
==15203== Address 0x51f9010 is 320 bytes inside a block of size 352
free'd
==15203== at 0x4025BF0: free (vg_replace_malloc.c:366)
==15203== by 0x42919C9: fclose@@GLIBC_2.1 (iofclose.c:88)
==15203== by 0x80A7544: ??? (in /usr/bin/python2.7)
==15203== by 0x810D8CA: ??? (in /usr/bin/python2.7)
==15203== by 0x81048B0: ??? (in /usr/bin/python2.7)
==15203== by 0x80E1207: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==15203== by 0x8105A60: ??? (in /usr/bin/python2.7)
==15203== by 0x80A4649: PyObject_Call (in /usr/bin/python2.7)
==15203== by 0x80A603E: ??? (in /usr/bin/python2.7)
==15203== by 0x80A4649: PyObject_Call (in /usr/bin/python2.7)
==15203== by 0x80DAD42: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15203== by 0x80E11E6: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==15203==
==15203== Conditional jump or move depends on uninitialised value(s)
==15203== at 0x80C131F: PyObject_Free (in /usr/bin/python2.7)
==15203== by 0x8105E2D: ??? (in /usr/bin/python2.7)
==15203== by 0x80BD444: ??? (in /usr/bin/python2.7)
==15203== by 0x80BDCAC: PyDict_SetItem (in /usr/bin/python2.7)
==15203== by 0x80BEB36: _PyModule_Clear (in /usr/bin/python2.7)
==15203== by 0x81396A8: PyImport_Cleanup (in /usr/bin/python2.7)
==15203== by 0x8070F4E: Py_Finalize (in /usr/bin/python2.7)
==15203== by 0x8070368: Py_Exit (in /usr/bin/python2.7)
==15203== by 0x80704CB: ??? (in /usr/bin/python2.7)
==15203== by 0x80704F1: PyErr_PrintEx (in /usr/bin/python2.7)
==15203== by 0x80707B2: PyErr_Print (in /usr/bin/python2.7)
==15203== by 0x8070B01: PyRun_SimpleFileExFlags (in /usr/bin/
python2.7)
==15203== Uninitialised value was created by a heap allocation
==15203== at 0x4026864: malloc (vg_replace_malloc.c:236)
==15203== by 0x80C11C8: PyObject_Malloc (in /usr/bin/python2.7)
==15203== by 0x80C5817: PyString_FromStringAndSize (in /usr/bin/
python2.7)
==15203== by 0x80E7C00: ??? (in /usr/bin/python2.7)
==15203== by 0x80E7D93: ??? (in /usr/bin/python2.7)
==15203== by 0x80E7D01: ??? (in /usr/bin/python2.7)
==15203== by 0x80E7DA8: ??? (in /usr/bin/python2.7)
==15203== by 0x80E7D01: ??? (in /usr/bin/python2.7)
==15203== by 0x80E7DA8: ??? (in /usr/bin/python2.7)
==15203== by 0x813ADB7: PyMarshal_ReadObjectFromString (in /usr/
bin/
python2.7)
==15203== by 0x813AE84: PyMarshal_ReadLastObjectFromFile (in /usr/
bin/python2.7)
==15203== by 0x8138C14: ??? (in /usr/bin/python2.7)
==15203==
==15203== Use of uninitialised value of size 4
==15203== at 0x80C132C: PyObject_Free (in /usr/bin/python2.7)
==15203== by 0x8105E2D: ??? (in /usr/bin/python2.7)
==15203== by 0x80BD444: ??? (in /usr/bin/python2.7)
==15203== by 0x80BDCAC: PyDict_SetItem (in /usr/bin/python2.7)
==15203== by 0x80BEB36: _PyModule_Clear (in /usr/bin/python2.7)
==15203== by 0x81396A8: PyImport_Cleanup (in /usr/bin/python2.7)
==15203== by 0x8070F4E: Py_Finalize (in /usr/bin/python2.7)
==15203== by 0x8070368: Py_Exit (in /usr/bin/python2.7)
==15203== by 0x80704CB: ??? (in /usr/bin/python2.7)
==15203== by 0x80704F1: PyErr_PrintEx (in /usr/bin/python2.7)
==15203== by 0x80707B2: PyErr_Print (in /usr/bin/python2.7)
==15203== by 0x8070B01: PyRun_SimpleFileExFlags (in /usr/bin/
python2.7)
==15203== Uninitialised value was created by a heap allocation
==15203== at 0x4026864: malloc (vg_replace_malloc.c:236)
==15203== by 0x80C11C8: PyObject_Malloc (in /usr/bin/python2.7)
==15203== by 0x80C5817: PyString_FromStringAndSize (in /usr/bin/
python2.7)
==15203== by 0x80E7C00: ??? (in /usr/bin/python2.7)
==15203== by 0x80E7D93: ??? (in /usr/bin/python2.7)
==15203== by 0x80E7D01: ??? (in /usr/bin/python2.7)
==15203== by 0x80E7DA8: ??? (in /usr/bin/python2.7)
==15203== by 0x80E7D01: ??? (in /usr/bin/python2.7)
==15203== by 0x80E7DA8: ??? (in /usr/bin/python2.7)
==15203== by 0x813ADB7: PyMarshal_ReadObjectFromString (in /usr/
bin/
python2.7)
==15203== by 0x813AE84: PyMarshal_ReadLastObjectFromFile (in /usr/
bin/python2.7)
==15203== by 0x8138C14: ??? (in /usr/bin/python2.7)
==15203==
==15203== Invalid read of size 4
==15203== at 0x80C1316: PyObject_Free (in /usr/bin/python2.7)
==15203== by 0x8160CA6: PyGrammar_RemoveAccelerators (in /usr/bin/
python2.7)
==15203== by 0x8070FC1: Py_Finalize (in /usr/bin/python2.7)
==15203== by 0x8070368: Py_Exit (in /usr/bin/python2.7)
==15203== by 0x80704CB: ??? (in /usr/bin/python2.7)
==15203== by 0x80704F1: PyErr_PrintEx (in /usr/bin/python2.7)
==15203== by 0x80707B2: PyErr_Print (in /usr/bin/python2.7)
==15203== by 0x8070B01: PyRun_SimpleFileExFlags (in /usr/bin/
python2.7)
==15203== by 0x805C068: Py_Main (in /usr/bin/python2.7)
==15203== by 0x805B25A: main (in /usr/bin/python2.7)
==15203== Address 0x4929010 is 32 bytes inside a block of size 668
free'd
==15203== at 0x4025BF0: free (vg_replace_malloc.c:366)
==15203== by 0x8160CA6: PyGrammar_RemoveAccelerators (in /usr/bin/
python2.7)
==15203== by 0x8070FC1: Py_Finalize (in /usr/bin/python2.7)
==15203== by 0x8070368: Py_Exit (in /usr/bin/python2.7)
==15203== by 0x80704CB: ??? (in /usr/bin/python2.7)
==15203== by 0x80704F1: PyErr_PrintEx (in /usr/bin/python2.7)
==15203== by 0x80707B2: PyErr_Print (in /usr/bin/python2.7)
==15203== by 0x8070B01: PyRun_SimpleFileExFlags (in /usr/bin/
python2.7)
==15203== by 0x805C068: Py_Main (in /usr/bin/python2.7)
==15203== by 0x805B25A: main (in /usr/bin/python2.7)
==15203==
==15203==
==15203== HEAP SUMMARY:
==15203== in use at exit: 522,966,454 bytes in 10,803 blocks
==15203== total heap usage: 14,067,230 allocs, 14,056,427 frees,
59,559,225,904 bytes allocated
==15203==
==15203== LEAK SUMMARY:
==15203== definitely lost: 168 bytes in 7 blocks
==15203== indirectly lost: 0 bytes in 0 blocks
==15203== possibly lost: 158,392 bytes in 435 blocks
==15203== still reachable: 522,807,894 bytes in 10,361 blocks
==15203== suppressed: 0 bytes in 0 blocks
==15203== Rerun with --leak-check=full to see details of leaked
memory
Received on 2011-07-18 10:16:44 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.