1

I am running gem5 simulator which uses C++ and python, and I have added more codes to it. When I use python 2.6 everything is alright, but the same code on a system with python 2.7 has very high memory leakage. The code is so big and I have no idea where is the source for memory leakage. I checked the code several times and it seems every object has been deleted.

Is it related to python version? How can I find the source of memory leakage?

NaSh
  • 665
  • 5
  • 16
  • Did it leak on 2.7 before you "added more codes to it"? I suggest you get to a point where there is no leak, then makes changes one step at a time, monitoring for leaks after each change. – cdarke Feb 28 '16 at 07:49
  • No memory leak before I add my code. However, my code only includes C++ code and no python code. Incremental coding is not possible, since the code is huge. – NaSh Feb 28 '16 at 07:52

1 Answers1

0

Assuming this memory leakage is related to python and not e.g. C++, you should check out this thread on tracking down such leaks. The LShift Blog describes scenarios, in which Python can leak memory:

  1. a C-library used leaks memory
  2. the Python code you write/use has global lists or dicts that grow over time and you forgot to remove objects after usage
  3. there are some reference cycles in the code
Community
  • 1
  • 1
jhoepken
  • 1,842
  • 3
  • 17
  • 24