I have Ubuntu 21.04 and I started to have a particular issue some time ago. I have python programs I run regularly, sometimes re-running the same thing without any differences. But since some time, my computer sometimes freezes.
I just ran some memory intensive python script, while having my System Monitor screen open. What I noticed, is that the used RAM and Swap memory fractions would steadily increase. After the used RAM reached about 95% (Swap was 100%), I killed the process. But both memories are still full!
I don't get it, isn't the system suppose to free memory after a process is done? Is this a bug? How can I free it?
$ free -h total used free shared buff/cache available Mem: 7,2Gi 6,5Gi 281Mi 20Mi 362Mi 378Mi Swap: 2,0Gi 2,0Gi 1,0Mi
$ ps -ao comm,%mem | sort -rnk2,2 | head python 72.4 gedit 0.6 Xorg 0.4 sort 0.0 python 0.0 python 0.0 ps 0.0 head 0.0 gnome-session-b 0.0 COMMAND %MEM