Valgrind hangs without output

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

I wanted to check, at least to the point that I came, I have a memory leak or not. However, starting valgrind just freezes, valgrind seems to work pretty hard, as the CPU load is high, but the output is not generated, even if I waited a while. I shuffled the manual pages, but could not find anything useful. I compiled valgrind-3.8.0 and used it now. And I shoot like I always did like

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

I also could not find a widget useful for this problem when searching on Google. Any ideas on the cause of this hanging behavior?

Editing 1: The following is the temporary output of the time command for the application

47740

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

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

Post with a similar problem

Editing 3: I noticed that it is interesting if the file size I'm trying to read is large, this problem occurs, if the file size is relatively small, this hanging does not happen, which is also strange for me.

+6
source share
2 answers

The large file offers more work. So valgrind takes more time. Valgrind is really very slow.

You can easily debug this with the best debugger in the world: printf () (just half joke). Just print something before or after each iteration of the main loop. If it does not appear, valgrind really hangs somewhere. The thoughtful placement of your printf () statements should show the exact location where it hangs (if it actually hangs, not slow).

+4
source
  • Perhaps your main program stream does not exit
  • wait valgrind exit
-1
source

Source: https://habr.com/ru/post/923064/


All Articles