File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes JIT(Just In Tim) compiler Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JIT(Just In Tim) compiler" Watch "JIT(Just In Tim) compiler" New topic

JIT(Just In Tim) compiler

T Rai

Joined: Apr 16, 2002
Posts: 20
hi folks,
i again ran into a term JIT. what is it? and how does it differ with JRE?
I read that Garbage collection scheme can vary dramatically across JVM implementaions. what does that mean?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
JIT is an acronym for Just In Time compiler. Java is an interpreted language. Interpreted language are generally slow beasts by nature. What a JIT does is optimizes calls at runtime using the native platform language to speed things up. The speed of Java applications now rival that of native applications because of JITs.
Garbage collection is one of the better aspects of Java. The language it was designed after, C++, has no such facility. The developer had to provide destructors to free resources whenever an object became orphaned. In deep inheritance trees, sometimes destructors would not be called as expected because a developer neglected to create a virtual destructor or override a destructor. This problem led to what is known as memory leaks, the program would eventually be starved for memory because orphaned objects would still be holding on to the memory that was allocated to them. The Java Garbage Collector or GC, keeps up with all object references and when it determines that there are no reachable references to an object it marks that object for garbage collection. When will the object be GCed? When the GC decides it needs the resources. The programmer has little control over it. He can suggest that everything be GCed by calling System.gc(), but in reality it is still up to the GC to actually clean up the orphaned objects as its whim. There is a lot of room for interpretation for how GC should be accomplished by the Java specifications so different JVM vendors will certainly do it in varying ways.

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
please refer to:
Java JIT compiler publications ;
Java JIT compiler ;
Bert Bates

Joined: Oct 14, 2002
Posts: 8898
Thulung -
Just to add a bit to what Michael said:
It won't really matter to you how the GC has been implemented. What *is* important is that you understand how to make sure that objects you're not using any more are eligible to be destroyed by the GC. If your program is creating a lot of large objects, it is good practice to make sure that all of the references to these objects are nulled or reassigned when you are done with the objects.
Once all of an object's references have been removed, the GC can destroy that object if it needs to.

Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
T Rai

Joined: Apr 16, 2002
Posts: 20
thank you all for your help. i appreciate.
John Lee
Ranch Hand

Joined: Aug 05, 2001
Posts: 2545
you are welcome!
I agree. Here's the link:
subject: JIT(Just In Tim) compiler
It's not a secret anymore!