Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get memory in use from core dump

Tags:

c++

gdb

coredump

I have a core dump file generated by a c++ program.

I suspect the reason it crashed is because it was running out of memory. Is there a way the get the amount of memory in use from the core file using gdb (or any other way)?

like image 765
Isac Avatar asked Nov 04 '22 06:11

Isac


2 Answers

According to this thread, it is not possible.

However, you can use size -A core to get the sizes of individual sections of the core dump (you won't know what they are, though).

like image 183
jpalecek Avatar answered Nov 12 '22 13:11

jpalecek


As a rough approximation, most of the data in a large core file should be the heap + stack(s).

External mmaps and executable code aren't copied in, so the total size should be close to the total process size before it died.

like image 45
Useless Avatar answered Nov 12 '22 12:11

Useless