Showing posts from October, 2010

how to get total Heap Size in JVM

Runtime runtime = Runtime.getRuntime();System.out.println("Total Heap Size of JVM"+runtime.totalMemory());

Increase JVM Heap Size for better performance.

Setting/Increase JVM heap sizeIt is possible to increase heap size allocated by the Java Virtual Machine (JVM) by using command line options. Following are few options available to change Heap Size.

How to examine the amount of free memory in java

Runtime runtime = Runtime.getRuntime();System.out.println ("Free memory : " - + runtime.freeMemory() );

ArrayList or vector


Its not thread safe-- its unsynchronized.ArrayList can be traversed with Iterator Interface.So Its faster compared to Vector.

It is thread safe and synchronized.Vector can be traversed with Enumeration--Interface