0

I am running a python script on linux terminal. The script has an infinite calculus loop and it never ends, so for now I'm stopping it with ctrl+C. After that, all the ram memory consumed by the program (which is a lot, and I don't find the leakage yet) is still consumed, until the moment I close the terminal. What can be happening?

Federico Caccia
  • 1,817
  • 1
  • 13
  • 33

2 Answers2

3

I would suggest using a combination of: How do I capture SIGINT in Python? and How can I explicitly free memory in Python?

#!/usr/bin/env python
import signal
import sys
import gc
def signal_handler(signal, frame):
        print('Cleaning up...')
        gc.collect()
        print('Bye.')
        sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
signal.pause()
Hezi Shahmoon
  • 388
  • 1
  • 7
0

it may be an infinte loop or just some calculations that took too much time, for the sake of completeness, can you please post your code?