What's the difference between freeMemory()
and totalMemory()
? Both are the total amount of memory currently available for JVM.
/**
*
* @return an approximation to the total amount of memory currently
* available for future allocated objects, measured in bytes.
*/
public native long freeMemory();
/**
*
* @return the total amount of memory currently available for current
* and future objects, measured in bytes.
*/
public native long totalMemory();