[Metakit] Hash view questions

zooko at zooko.com zooko at zooko.com
Sat Feb 4 12:43:38 CET 2006


> Your sample code does show increasing memory use on my setup as  
> well.  Is there a way to find out what the content or at least sizes/ 
> counts of the leaked memory areas is in Python?

Yes!  A beautiful tool known as valgrind [1].  It tells me that you are right
and the C++ metakit code is exonerated.

This is because the stack traces of the code that allocated the leaking memory
do not have any metakit functions in them.  Hm... the biggest one has
posix_read() in it.  The other two are both involving allocation of Python
Ints...

Regards,

Zooko


94783800 bytes in 96325 blocks are possibly lost in loss record 143 of 145
   at 0x11B1CE96: malloc (vg_replace_malloc.c:149)
   by 0x4442E9: PyObject_Malloc (obmalloc.c:724)
   by 0x444757: _PyObject_DebugMalloc (obmalloc.c:1017)
   by 0x4295B5: fill_free_list (intobject.c:49)
   by 0x429691: PyInt_FromLong (intobject.c:100)
   by 0x42815C: float_int (floatobject.c:920)
   by 0x417AB6: PyNumber_Int (abstract.c:978)
   by 0x42B959: int_new (intobject.c:892)
   by 0x452EA8: type_call (typeobject.c:421)
   by 0x4199C6: PyObject_Call (abstract.c:1816)
   by 0x48C9D7: do_call (ceval.c:3773)
   by 0x48C21B: call_function (ceval.c:3588)


98623368 bytes in 100227 blocks are possibly lost in loss record 144 of 145
   at 0x11B1CE96: malloc (vg_replace_malloc.c:149)
   by 0x4442E9: PyObject_Malloc (obmalloc.c:724)
   by 0x444757: _PyObject_DebugMalloc (obmalloc.c:1017)
   by 0x4295B5: fill_free_list (intobject.c:49)
   by 0x429691: PyInt_FromLong (intobject.c:100)
   by 0x48291D: PyEval_EvalFrameEx (ceval.c:1128)
   by 0x48A0F7: PyEval_EvalCodeEx (ceval.c:2739)
   by 0x48C53A: fast_function (ceval.c:3658)
   by 0x48C202: call_function (ceval.c:3586)
   by 0x487EBC: PyEval_EvalFrameEx (ceval.c:2181)
   by 0x48C42B: fast_function (ceval.c:3647)
   by 0x48C202: call_function (ceval.c:3586)


233832448 bytes in 892 blocks are still reachable in loss record 145 of 145
   at 0x11B1CE96: malloc (vg_replace_malloc.c:149)
   by 0x443E39: new_arena (obmalloc.c:429)
   by 0x4442C4: PyObject_Malloc (obmalloc.c:706)
   by 0x444757: _PyObject_DebugMalloc (obmalloc.c:1017)
   by 0x44600A: PyString_FromStringAndSize (stringobject.c:74)
   by 0x4C1D6B: posix_read (posixmodule.c:5569)
   by 0x4E1894: PyCFunction_Call (methodobject.c:73)
   by 0x48C0BF: call_function (ceval.c:3565)
   by 0x487EBC: PyEval_EvalFrameEx (ceval.c:2181)
   by 0x48C42B: fast_function (ceval.c:3647)
   by 0x48C202: call_function (ceval.c:3586)
   by 0x487EBC: PyEval_EvalFrameEx (ceval.c:2181)

LEAK SUMMARY:
   definitely lost: 8064 bytes in 6 blocks.
     possibly lost: 193750661 bytes in 196771 blocks.
   still reachable: 234898784 bytes in 943 blocks.
        suppressed: 0 bytes in 0 blocks.


[1] http://valgrind.org/


More information about the Metakit mailing list