• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Garbage collection

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I want to know exact mechanism running behind garbage collection in java
I mean how jvm performs garbage collection
Does it involve lots of memory utilisation.

Thanks in Advance
Sudarsan
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The exact mechanism is meant to be a mystery. The JVM authors have a lot of freedom in what they can do, and developers who write code to run on the JVM don't have to worry about GC. In fact, if you knew much about GC and tried to optimize your code based on what GC is going to do, your code might be a disaster on another JVM or the next release of the JVM.

So, all those warnings aside, GC is fascinating and deeply complex. If you Google for Java Garbage Collection you'll find some details on various JVM versions with some tips about how to analyze problems and adjust tuning. I've been able to successfully ignore it except for a very few times when tuning was necessary.
 
sudharshan tettu
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you

I just want to know garbage collection itself involeves lots of memory , i mean to keep track of things it needs to collect and check which are the things that have no longer any refernce..etc
i mean lots of stack and heap space
Then why it is still considered
correct me if am wrong
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Most modern garbage collectors use some variant of a "mark and sweep" algorithm, which uses a single bit of storage for each memory block (each object). The heap allocator itself will use more than that, of course, so the memory usage of the collector is very modest.
 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There was a series on developerworks named something like Inside the IBM Garbage Collector,
it was describing the logic behind the garabage collector of IBM's JVM implementation which may give you a good understanding.
 
reply
    Bookmark Topic Watch Topic
  • New Topic