0

I have a python3 program that does a certain amount of iterations for a certain problem. When the problem is too complex, the program might run out of memory. How can I check the available RAM of the hardware in python3 in order to break a cycle when reaching a certain amount of RAM usage?

running on Ubuntu 19.04

One (not so great) way of doing this that I can think of is calling os.sytem and scraping the RAM usage value of a command like "free".

Miguel
  • 1,184
  • 7
  • 24
  • Try this [link](https://github.com/Damodharan5/Mini_Pyth_proj/blob/master/Server_PC_Status/ram_usage.py) – C Damo Sep 11 '19 at 19:02
  • 2
    https://stackoverflow.com/questions/276052/how-to-get-current-cpu-and-ram-usage-in-python – C Damo Sep 11 '19 at 19:11

0 Answers0