Search code examples
valgrind

Without looking at the code, is it possible to tell the size of Valgrind's VG_N segments?


I am using Valgrind on a remote server and it may have been customized, I do not know. When running certain programs I get an error saying that VG_N Segments is too low. I believe this means that the memory requested by the program is too large given Valgrind's memory pool. I'm not interested in fixing this within the install (I don't have root anyway and those who do are not likely to want to recompile it just for me) but I am interested in knowing how much memory my program tried to use before the failure.

Alternatively, is there a way to figure out memory use without Valgrind? I don't care about leaks at this point, just knowing how much memory my program requested, as a maximum, during a run.

This is on Ubuntu 20.04, Valgrind version 3.something (I'm afraid I don't know the exact Valgrind version)


Solution

  • Not really. You may be able to work it out by using the -d argument. That will cause address space dumps at various times during execution, and you will see things like

    --13467:1: aspacem <<< SHOW_SEGMENTS: Memory layout at client startup (36 segments)
    --13467:1: aspacem <<< SHOW_SEGMENTS: Memory layout at client shutdown (62 segments)
    

    Alternatively you might be able to run memcheck under gdb. See README_DEVELOPERS in the Valgrind source repo for details.