0

I've got a python program which uses C libraries (through swig), on a Linux machine. I'd like to know how much memory is allocated by these libraries, and how much is allocated by the python interpreter.

If I'm correct, total memory of the process should be (more or less) the sum of interpreter's private heap size, plus memory allocated by the libraries.

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
yhuelf
  • 1
  • 1
  • 2

1 Answers1

1

Here the total memory used by python

I guess this would also work with any other process but shows only the total size and no details. For more details on the objects python keeps you can always ask your friendly garbage collector.

For C modules under windows i found the CRT library really useful
Finding Memory Leaks Using the CRT Library

you need to compile the c module as debug though to enable it. This even shows the places where it was allocated.

Community
  • 1
  • 1
ersteller
  • 71
  • 4