A little ago, out of curiosity, I wrote a Java program that takes up a lot of memory very fast. (It adds BufferedImages to an arraylist in a loop.)
I kept the Windows System Monitor open to observe the RAM usage as it ran.
When I started the program, the RAM usage climbed really fast, and as it reached about 100% of my 6GB of RAM, my computer became extremely slow. After about one minute, I managed to terminate the program and my computer slowly recovered speed. What caught my attention was that the memory usage first dropped slowly, then suddenly it went right down to almost 0MB before climbing back up to to idle usage at around 2-2.5GB.
I took a screenshot of the RAM usage in the System Monitor:
I was wondering if anyone could explain what happens as the computer runs out of memory and why it doesn’t go back to idle right after the program ends but rather about 60 seconds later? Also, why does the usage go all the way down to nothing instead of just idle usage?