Dumping the content of a lost memory block

View: New views
1 Messages — Rating Filter:   Alert me  

Dumping the content of a lost memory block

by Alexander Farber :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I'm using valgrind 2.4.0 on RH9 Linux (thank you!) and it keeps
reporting, that I have 1 memory leak in my C-program:

==17058== 260 bytes in 1 blocks are definitely lost in loss record 1 of 2
==17058==    at 0x1B90359D: malloc (vg_replace_malloc.c:130)
==17058==    by 0x80497FE: new_node (pref.c:514)
==17058==    by 0x80499A2: copy_node (pref.c:598)
==17058==    by 0x8049E45: accept_new (pref.c:739)
==17058==    by 0x8048FE9: main (pref.c:299)
==17058==
==17058== LEAK SUMMARY:
==17058==    definitely lost: 260 bytes in 1 blocks.
==17058==      possibly lost: 0 bytes in 0 blocks.
==17058==    still reachable: 4420 bytes in 17 blocks.
==17058==         suppressed: 0 bytes in 0 blocks.

I'm trying already since few days, but still can't find that leak.
In the new_node() function mentioned above I malloc()
a structure (about 20 times) and keep the track to it in a
singly-linked tail queue.

Since valgrind probably keeps track to all malloc()ed areas,
is it possible to make it print the content of that lost area?
Then I could identify, which particular node of the list gets lost.

I've tried calling my program with "valgrind --leak-check=yes
--db-attach=yes ./myprog", but it doesn't ask to attach...

Regards
Alex


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click
_______________________________________________
Valgrind-users mailing list
Valgrind-users@...
https://lists.sourceforge.net/lists/listinfo/valgrind-users