Search code examples
c++memoryvalgrindprofilermassif

Why memory profiler doesn't show all the used memory?


When I am starting my application under valgrind with massif option I see 52.6 MiB peak usage. enter image description here But htop says the process took 875MB of RES memory. enter image description here enter image description here

The same behavior has heaptrack. Does anyone know why profiler doesn't report where 800+MB gone?


Solution

  • Massif by default measures only the heap managed by malloc and friends. It doesn't attempt to track pages mapped by other means (for example with mmap).

    In order to account for all pages, one needs to run massif with --pages-as-heap=yes.

    Source: Massif manual.