This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
The JVM does garbage collection for us. The algorithms are wonderfully complex and varied. It seems every new release of the JVM has improved gc. Googling on "Sun garbage collection algorithm" got a few hits like THIS. Note it is specific to one particular dot release of the JVM.
This is a fascinating area, but one we really should stay away from in coding. Don't try to optimize your code for some particular gc version, or try to invoke the gc yourself to improve performance. I trust that it is far smarter than I am, and it is likely to change in ways that will make my optimization today the worst possible choice tomorrow. So read it, be impressed, and try to forget.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Joined: May 07, 2007
Thanks for your timely response! My sincere appologise for the inconvinience cause to you due to my communication gap and wasted your precious time. I am very new to java and to javaranch also, now only I trying a job.
One interviewer asked me like: What all are the algorithm using by jvm for garbage collection? What is the purpose of each?
For eg: mark and sweep is one of the algorithm using by garbage collection. but he(inteviewer) say there is some more algorithm is available and each one is do one process while doing the garbage collection operation.
Joined: Jan 29, 2003
Follow up with the Google search I suggested, or craft your own search around mark-sweep and see what alternatives show up. This is neat stuff and in rare situations someone will really have to dig into all the tuning options on the JVM. I've always managed to make sure that wasn't me, so I can't rattle off the details.
An interviewer asking that sort of question was either: -
(A) Not really expecting you to list all possible algorithms and describe them in detail, but instead just hoping to find out what you did know and whether you could talk intelligently on a non-trivial technical subject
... or ...
(B) A fool who didn't realise what a tough question it was
I guess you'll have determined which it was, by how the rest of the interview went.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Joined: May 07, 2007
Hi Thanks for your explanation. At last peter make me fool