Is there an easy way to know the total amount of memory that has been allocated by every malloc in the program? I'm suffering from a memory leak and I want to find out where it is.
There is no way in a standard, operating system neutral, fashion.
But with GNU Glibc you have mallinfo
On Linux systems, you can learn about your virtual memory map thru the /proc/self/maps (or /proc/self/smaps which gives more details) pseudo-file. For process of pid 123 you can read /proc/123/maps
Of course, details are system specific.
To find a memory leak, use a tool like valgrind
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With