• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Forcing Garbage Collection

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Time is mother nature's way of keeping everything from happening at once. And this is a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic