I want to Know how can I make my python program run in such a say that it takes only specified amount of memory (say x bytes) to run, and in case of it requires more memory than x it should be terminated.
I want something like this:
if memory_required > x:
Terminate program
else:
Let the program run
listinstances take and stuff. What did you expect, then? Do you have that much storage on your machine? If it's still unresponsive, you may have to manually unplug it.