16

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]

skaffman
  • 398,947
  • 96
  • 818
  • 769
Andraž Tori
  • 290
  • 1
  • 2
  • 9
  • I've tried a few different tools: straight gdb, gdb + libpython, gdbheap, custom .gdbinit. – Andraž Tori Jan 24 '11 at 15:12
  • I think the similar problem has already been solved here: [segmentation fault - core dump in python C-extension](https://stackoverflow.com/questions/29396600/segmentation-fault-core-dump-in-python-c-extension) – k500 Jan 12 '19 at 16:10

2 Answers2

1

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

sunil
  • 491
  • 4
  • 10
1

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 
Tyson90
  • 106
  • 8