2

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?

teoring
  • 115
  • 13
  • massif only measures heap usage ad not mapped memory (by default). Did you try `--pages-as-heap=yes`? – n. m. could be an AI Jan 07 '21 at 12:40
  • @n.'pronouns'm. You can submit this as answer. This is what I need. – teoring Jan 07 '21 at 12:44
  • Although your columns headers are somehow misaligned, it seems to show 875M virtual of which 812M is shared. Do you _want_ to count shared memory (such as mapped shared libraries) as "used"? That memory might have been used even without your process, and the ~63M difference looks about right. – Useless Jan 07 '21 at 13:09

1 Answers1

1

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.

n. m. could be an AI
  • 112,515
  • 14
  • 128
  • 243