Runtime.getRuntime().maxMemory()
shows which memory ? Is it Survivor , Eden , Old, Permanent ?
According to API, Returns the maximum amount of memory that the Java virtual machine will attempt to use. If there is no inherent limit then the value Long.MAX_VALUE will be returned.
It is the maximum size of the heap. It is loosely based on the -mx
or -Xmx
command line argument but for reasons I don't understand can be 1-5% less (It doesn't seem to be ever exactly the same)
What this doesn't include is the perm gen, the direct memory, memory mapped files, stack spaces or shared libraries.
While it doesn't include everything is it usually 80-90% the total memory usable for most applications.