Reputation: 2649
Given an active/live process in linux, how can I dump the memory to analyze the memory leak?
I usually use valgrind but unfortunately, valgrind made the application run extremely slow that it couldn't complete the initialization with other processes on other server.
One of the attempted answers in this post suggested diffing /proc/[PID]/smaps
to locate the region of memory that is growing.
I tried that and the diff contains:
+02511000-2eb548000 rw-p 00000000 00:00 0 [heap]
+Size: 12206300 kB
+Rss: 12105644 kB
+Pss: 12105644 kB
Then I tried to use gdb to attach to the live process and do:
(gdb) dump memory ./dump_outputfile.dump 0x02511000 0x2e2548000
./dump_outputfile.dump: Success.
Then, I detached and realized the dump file is empty aka zero byte.
Am I missing something?
Upvotes: 1
Views: 1385
Reputation: 32586
(gdb) dump memory ./dump_outputfile.dump 0x02511000 0x2e2548000
are you sure about the addresses ?
the area you want to dump is about 11Go !
is that too much for gdb ? try with a smaller size
of course check you have enough free disk space for the result
Upvotes: 2