Tuesday, July 20, 2010

Java Environment



The picture above tells us a big picture of Java. Some codes written in Ada, Cobol, and C can be compiled into java byte code. The .class java byte code then translated by JVM into native machine language.

So, what is JVM? Lets see java installation directory:
1. JDK = java programs (java.exe, javac.exe, jar.exe, etc) + JRE
2. JRE = collection of Java API (lang, util, text, io, net, math, nio)
3. JVM = instance of JRE

Another term is JIT which is a part of JVM that compiles java byte codes that have similar functionality at the same compiling time so it will reduce compile time.

Java Heap Space

Heap is a part of memory used by JVM to allocate objects. There are three types of Java heap space:
1. Young Generation: Space to save short-live objects, they are method-scope objects or loop-scope objects.
2. Old/Tenured Generation: Space to save long-live objects, they are class-scope and application-scope objects.
3. Permanent Generation (permgen): Space to save class definition and its metadata.

There are some arguments that can be used to configure heap space:
1. -Xmx256M : Maximum heap space value is 256 MB.
2. -Xms128M: Initial heap space value is 128 MB. It will grow until xmx value is reached.
3. -Xmn64M: Heap space allocated for young generation.

There is nothing mentioned about default java heap space. It varies between machine, but wikipedia says it is 128M.

0 comments:

 

©2009 Stay the Same | by TNB