|
From: Fernando C. <fgm...@ya...> - 2009-01-23 12:34:46
|
Hi, I am trying to use valgrind to find a memory leak in a program, the program is a server that keeps running and storing memory until it crashes after some time.
Well, here is what I have done:
I successfully installed valgrind 3.4.0, so I recompiled the source, in the makefile I added edited the following lines:
CC = (added this) gcc -E -dynamic -oo -g
CPP = gcc -E (added this)-dynamic -oo -g
CPPFLAGS = (added this) -E -dynamic -oo -g
Then I copied de executable to the directory it should be and finally i ran the valgrind with the following command:
valgrind --tool:memcheck --trace-children=yes --leak-check=full /program-name argument
He tells me no error was found:
==26920== LEAK SUMMARY:
==26920== definitely lost: 0 bytes in 0 blocks.
==26920== possibly lost: 0 bytes in 0 blocks.
==26920== still reachable: 63,322 bytes in 4,807 blocks.
==26920== suppressed: 0 bytes in 0 blocks.
==26920== Reachable blocks (those to which a pointer was found) are not shown.
Also the is the message: "All heap blocks were freed -- no leaks are possible."
Which, acording to the FAQ could indicate an error, but I compiled with the -dynamic command on the Makefile, so any help, I'm new with linux so I might have screwed up in some point.
Also, is there any option that tell valgrind to keep running and logging for more time?
Thanks in advance.
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com |
|
From: Christoph B. <bar...@or...> - 2009-01-23 13:56:18
|
Hi, you seem to run valgrind correctly. But did you run your server long enough to encounter a memory leak? Additonally you could check the memory that is reported as still reachable. Maybe you have a growing list that is still reachable but also causes memory creep. Christoph |