How to analyze memory usage from a core dump?

Andraž Tori picture Andraž Tori · Jan 14, 2011 · Viewed 10.2k times · Source

I have a core dump under Linux. The process went on memory allocation rampage and I need to find at least which library this happens in.

What tool do you suggest to get broad overview of where the memory is going? I know the problem is hard/unsolvable fully. Any tool that could at least give some clues would help.

[it's a python process, the suspicion is that the memory allocations are caused by one of the custom modules written in C]

Answer

Tyson90 picture Tyson90 · Jan 16, 2019

Problem: need to find which library malfunctions memory.

Solution:

1) Use valgrind to find out Invalid Write or Invalid Free of Memory

$ valgrind --tool=memcheck --error-limit=no --track-origins=yes (python your script) 

2) Use gdb's mmap command to find out which address space the library is on

$ gdb (your executable) -c (core)
$ vmmap