import java.util.*;

public class MemoryCheck {
	static List list = new ArrayList();
	byte[] buf = new byte[1024 * 1024 * 10];
	
	static long getMB(long x) {
		return x / 1024 / 1024;
	}
	static void printMemory() {
		System.out.println("maxMemory=" + getMB(Runtime.getRuntime().maxMemory()) + "MB");
		System.out.println("totalMemory=" + getMB(Runtime.getRuntime().totalMemory()) + "MB");
		System.out.println("freeMemory=" + getMB(Runtime.getRuntime().freeMemory()) + "MB");
		System.out.println("usedMemory=" + getMB(Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory()) + "MB");
		System.out.println("");
	}
	public static void main(String[] args) {
		printMemory();
		for (int i=0; true; i++){
			System.out.println("alloc - " + (i+1));
			list.add(new MemoryCheck());
			printMemory();
		}
	}
}
