cogDisplays available memory in the JVM
Developed by

Vincent Massol

0 Votes
LicenseGNU Lesser General Public License 2.1


Sometimes you wish to see how much memory the JVM really has. To do so, you can copy this code in any wiki page to execute it:

println "Current size of heap in bytes: ${Runtime.getRuntime().totalMemory()}"
println "Maximum size of heap in bytes. ${Runtime.getRuntime().maxMemory()}"
println "Amount of free memory within the heap in bytes: ${Runtime.getRuntime().freeMemory()}"

For more thorough information about the JVM see Accessing JVM information using JMX.

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Created by Vincent Massol on 2012/10/18 13:23

Get Connected