• 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

garbage collections

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in an interview one question is asked to me but dn't answered properly
plz send the coorect one with explanation
the question was:
"How garbage collection is done in Java compiler ?"

regards
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my understanding, if a object in you program is on longer pointed by any variables, this object will be released automatically by Java garbage collection.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Garbage collection isn't done by the compiler, but by the jvm.

If it was done by the compiler, all our nice programs would go to the trashcan perhaps ?
 
Ranch Hand
Posts: 815
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
either that or our really bad ones. If you try to compile some truly horrendous code, the garbage collector gets it.
 
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is this actually a question about some nuance of javac and how garbage collection is performed while compiling or just a misguided query as previous responses suggest? I understand that Sun's javac is implemented in Java so it must run in a JVM. I would expect it to run the same way as any other Java program, with a separate GC thread. However, it wouldn't surprise me if it operated differently somehow in some subtle way that would have no impact on 99% of us. Even if that were the case my gut reaction is to ask why would I care? Code gets compilied, garbage gets collected, what more is there to know?

Jules
 
reply
    Bookmark Topic Watch Topic
  • New Topic