Any ideas why this memory leak is not being detected by valgrind?

Because it's not really possible to do so.  Consider the problem of knowing
when an mmap-d page is no longer in use.  Those pages are presumably managed
by your app, in some way that is unknown to Valgrind/Memcheck, hence it has
no way to know when a page is, logically speaking, leaked.

By contrast, blocks in the normal malloc/free heap are "managed" by a
simple protocol (calling malloc, then free) that Memcheck knows about.
So it can figure out when a block is leaked by checking whether any
pointers to it exist.  Even then, that's a heuristic hack: you could
conceivably represent a block address into two values, which, when added
together, produce the address.  Then Memcheck will believe the block to
be leaked, even though you could regain access to it merely by adding
the two values together.

J



_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to