Here you can find the source of getFreeMemory()
public static long getFreeMemory()
//package com.java2s; /*/*from w w w .ja va 2 s .c om*/ * $Id$ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */ public class Main { private static Runtime runtime = Runtime.getRuntime(); private static long lastMemoryReading = 0; public static long getFreeMemory() { lastMemoryReading = runtime.freeMemory(); return lastMemoryReading; } }