As stated in javadoc, the method returns
"The approximate value of the total memory currently available for future allocated objects, measured in bytes."
See also: Java - Runtime.freeMemory ()
As methods return approximations, it is difficult to detect small differences. To get more information about the memory used by the application, you can see more about memory using the profiling tool. For example, check out the Eclipse memory analyzer https://eclipse.org/mat/
Update: Reply to the update. The methods are implemented in the JVM, which means implementation, and perhaps the approximation accuracy can vary between different JVMs, i.e. returning results to JVMs running on Windows or Linux, and the android can return different values.
Also totalMemory() based on javadoc: http://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#totalMemory%28%29
Gets the total amount of memory in the Java virtual machine. the value returned by this method may change over time, depending on the host environment.
Please note that the amount of memory required to store an object of any type may be implementation dependent.
So you also use a different approximation, which also changes over time. Using only freeMemory() to calculate the free memory reduction might be better.
source share