|
From: Esther P. E. <est...@de...> - 2004-10-14 16:03:05
|
Hello all, I am running Valgrind to check memory leaks in a C executable file (example) that is calling a dynamic library (.so) I have developed myself. I run Valgrind with the following options, to get full information: valgrind --logfile-fd=9 --leak-check=yes -v ./example 9> output The output file contains the full error information and it displays the following: ********************************************* ==25573== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 3) --25573-- --25573-- supp: 1 __pthread_mutex_unlock/_IO_funlockfile --25573-- supp: 15 pthread_error/__pthread_mutex_destroy/_IO_default_finish --25573-- supp: 1 pthread_error/__pthread_mutex_destroy/__closedir ==25573== malloc/free: in use at exit: 1174263 bytes in 35554 blocks. ==25573== malloc/free: 126553 allocs, 90999 frees, 22499531 bytes allocated. ==25573== ==25573== searching for pointers to 35554 not-freed blocks. ==25573== checked 10447172 bytes. ==25573== ==25573== definitely lost: 0 bytes in 0 blocks. ==25573== possibly lost: 0 bytes in 0 blocks. ==25573== still reachable: 1174263 bytes in 35554 blocks. ==25573== ==25573== LEAK SUMMARY: ==25573== definitely lost: 0 bytes in 0 blocks. ==25573== possibly lost: 0 bytes in 0 blocks. ==25573== still reachable: 1174263 bytes in 35554 blocks. ==25573== Reachable blocks (those to which a pointer was found) are not shown. ==25573== To see them, rerun with: --show-reachable=yes ==25573== --25573-- lru: 1461 epochs, 0 clearings. --25573-- translate: new 20125 (305073 -> 4356072), discard 0 (0 -> 0). --25573-- dispatch: 73050000 basic blocks, 1463/1103215 sched events, 874605 tt_fast misses. --25573-- reg-alloc: 6744 t-req-spill, 788038+50897 orig+spill uis, 107245 total-reg-r. --25573-- sanity: 1464 cheap, 59 expensive checks. ********************************************* Well, I am using POSIX pthread library and I have already seen in the Valgrind documentation this library contains some memory leaks, so for that reason I suppose they appear as 'suppresed'. But what about the other error: ==25573== malloc/free: in use at exit: 1174263 bytes in 35554 blocks. ==25573== malloc/free: 126553 allocs, 90999 frees, 22499531 bytes Is this error related to the pthread errors and for that reason is displayed after those ones? I have checked the full code and all malloc/free commands seems to be OK, and there are no memory leaks... Could these memory leaks be caused by pthread library? How can I get the function that is causing this error? Which Valgrind option can I use to debug? I have already set the '-g' debugging flag to all Makefiles (the Makefile of the library and the one for the executable...) Thanks in advance, I am newbie with Valgrind and could not find more info in the web's doc! :( esther -- ~ Code matters more than comercials ~ -- |
|
From: David E. <tw...@us...> - 2004-10-14 16:57:15
|
On Thu, 2004-10-14 at 18:00, Esther Parrilla Endrino wrote:
> ==25573== LEAK SUMMARY:
> ==25573== definitely lost: 0 bytes in 0 blocks.
> ==25573== possibly lost: 0 bytes in 0 blocks.
> ==25573== still reachable: 1174263 bytes in 35554 blocks.
> ==25573== Reachable blocks (those to which a pointer was found) are not
> shown.
> ==25573== To see them, rerun with: --show-reachable=yes
^^^^^^^^^^^^^^^^^^^^
Did you ever see that message and suggested command line parameter?
--
Regards,
-\- David Eriksson -/-
SynCE - http://synce.sourceforge.net
CalcEm - http://calcem.sourceforge.net
ScummVM - http://scummvm.sourceforge.net
Desquirr - http://desquirr.sourceforge.net
SetiWrapper - http://setiwrapper.sourceforge.net
|
|
From: Tom H. <th...@cy...> - 2004-10-14 16:58:27
|
In message <1097769658.1507.21.camel@pc_espe>
Esther Parrilla Endrino <est...@de...> wrote:
> Well, I am using POSIX pthread library and I have already seen in the
> Valgrind documentation this library contains some memory leaks, so for
> that reason I suppose they appear as 'suppresed'.
There is a single small leak in the threads library, and that is
memory that could only be freed at exit time anyway so it doesn't
really matter,
> But what about the other error:
>
> ==25573== malloc/free: in use at exit: 1174263 bytes in 35554 blocks.
> ==25573== malloc/free: 126553 allocs, 90999 frees, 22499531 bytes
>
> Is this error related to the pthread errors and for that reason is
> displayed after those ones?
No. That is a summary of the memory in use when the program exits
and is printed after the leak reports.
> I have checked the full code and all malloc/free commands seems to be
> OK, and there are no memory leaks...
Indeed there aren't. What there is however is a lot of allocated
memory which your program still has valid pointers to when it exits.
If you want all the memory blocks to be reported rather then just
those that are no longer reaachable, then add this:
--show-reachable=yes
> Could these memory leaks be caused by pthread library?
No.
Tom
--
Tom Hughes (th...@cy...)
Software Engineer, Cyberscience Corporation
http://www.cyberscience.com/
|