Umut Tabak
Umut Tabak

Reputation: 1942

Valgrind is hanging with no output

For a method that I am trying to code for one of the classes I have been working on, I am trying to read double values from a file and dynamically set some arrays inside the program with these numeric values.

I wanted to check, at least up to the point that I came, whether I have memory leaks or not. However, firing up valgrind just hangs, valgrind seems to work quite heavily since the cpu loading is high, but no output is generated even if I have been waiting for some time now. I have shuffled through the pages of the manual however could not find something useful. I compiled valgrind-3.8.0 and using that now. And I am firing it the way I have always done as

valgrind --leak-check=yes --log-file=valgrind_log ./binary_to_execute args_if_any

I could not also find sth useful for this hanging problem on google search. Any ideas on the reason of this hanging behaviour?

Edit 1: Here is a timing output from time command for the application

47740

real    0m1.299s
user    0m1.116s
sys     0m0.176s

Edit 2: Here is a link which is more or less the same as the problem that I am experiencing,

A message with a similar problem

Edit 3: I have noticed sth interesting, if the file size that I am trying to read is large this problem occurs, if the size of the files are relatively small, this hanging does not occur, which is also strange to me.

Upvotes: 11

Views: 13557

Answers (2)

Nikos C.
Nikos C.

Reputation: 51832

A large file suggests more work to be done. So valgrind needs more time. Valgrind really is very slow.

You can easily debug this with the world's best debugger: printf() (only half-kidding.) Simply print something before or after every iteration of your main loop. If it doesn't show up, valgrind is really hanging somewhere. Thoughtful placement of your printf() statements should reveal the exact location where it hangs (if it actually hangs rather than being slow.)

Upvotes: 9

chlaws
chlaws

Reputation: 30

  1. maybe your program main thread not exit
  2. wait valgrind exit

Upvotes: -1

Related Questions