I am running a python program that, for some reason, goes crazy once in a while. I am then forced to kill the program but the RAM and Swap used by the program is not released. This causes the hanging issue during shutdown as has already been reported by other users.
The solution to the hanging issue is to clear the Swap prior to shutdown. The only way I have seen online to clear Swap is through the use of swapoff/swapon. However, use of swapoff requires enough RAM to move everything over (even if the data is no longer in use).
The issue is that the program sometimes also fills the RAM. Thus, the system will refuse to execute swapoff. Is there some way to clear Swap without requiring RAM or am I just going to have to cut power to my computer every time this happens? Alternatively, is there a way to clear RAM so that there is enough space to run swapoff? Or perhaps there is a way to find the memory claimed by the killed program and have Ubuntu clear just that?
0 Answers