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".