• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

One quick question in the Garbage collection?

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
What all are the algorithm we are using in the garbage collection? what is the purpose of each algorithm? can you please explain me for my hard question which is simple to you?

Thanks

Shanmugam
 
Ranch Hand
Posts: 2412
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what you mean.

A Java programmer doesn't perform garbage collection.
 
(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 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.
 
Shanmugam nagaraj
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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.


thanks
Shanmugam
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Shanmugam nagaraj
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Thanks for your explanation.
At last peter make me fool
 
reply
    Bookmark Topic Watch Topic
  • New Topic