• Post Reply Bookmark Topic Watch Topic
  • New Topic

Forcing Garbage Collection  RSS feed

 
Siddharth Jain
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can we force garbage collection in Weblogic? How does it take place?
What is the difference between a Full GC and a normal GC?
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't force a garbage collection. Calling System.gc() will encourage the JVM to strongly consider the idea, but it's only encouragement.
As for full vs normal GC: Java has a generational garbage collector. People have noted that a lot of objects tend to be very short-lived. They're created, used, and thrown away. Based on that observation, it's possible to optimize the collection process by dividing the heap into "generations".
New objects are allocated in the young part of the heap (which the people at sun call 'Eden'). If they survive a few garbage collections, they're moved to the "tenured" part of the heap. When the young generation runs out of space, a "normal" garbage collection runs, affecting only the young generation. During garbage collection, young objects will be deleted, marked as being slightly older, or moved to the tenured generation. When space is getting tight in the tenured generation (or if the JVM just feels like it), it does a "Full GC". The full GC removes dead objects from the tenured generation, but takes a bit more time than a normal GC.
There's an excellent summery at Sun's site.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!