totalMemory()returns the amount of memory that is currently in use, and maxMemory()indicates how much the JVM can allocate in total.
Note: this implies: totalMemory() <= maxMemory()and you can also get "how much memory is left"maxMemory() - totalMemory()
, , , totalMemory() .
: , .