What is Wrong With Java’s Memory Management

While Java and the JVM do have a lot going for them their pressure driven memory management system needs some work.  The problem stems from the fact that it is “Pressure Driven” so the garbage collector only runs when memory pressure gets high enough.  However that is not system memory, no that is Java Heap memory which means if your program’s heap gets really big say 512mb and your system is running out of memory but you are only using 400mb of that Java heap then the Java garbage collector will prolly not run. From Java’s view point you have lots of space left, but from your systems view point you are running out of memory so it need to start swapping to the hard drive and as soon as it does you can kiss performance goodbye.


Pressure driven garbage collection works best when you look at the system as a whole not just your own heap.

Leave a Reply