开发者

How to analyze memory usage from a core dump?

开发者 https://www.devze.com 2023-02-04 13:41 出处:网络
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.

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开发者_JAVA技巧 custom modules written in C]


Try running linux perf tool on the python process with callgraph enabled. if its multi threaded process give all associated LWPs as arguments.


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 
0

精彩评论

暂无评论...
验证码 换一张
取 消