Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic