• 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

Another garbage collection!

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the statement true or false?
Garbage Collection feature of Java ensures that the program never runs out of memory.
I think it is right. But the answer shows me that is wrong.
 
Enthuware Software Support
Posts: 4810
52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No system in this world can ensure that the porgram will never run out of memory!!! Memory is always limited.
This is what happened with us in a project that I worked on. We did not know that the GC never collects the Strings. We were creating huge XML String messages in our application and every 2-3 hr we were running out of memory. That's when we realized our fault and changed our program to use StringBuffers instead.
Anyway, the answer to you question is, if you create huge objects and don't release their references, you'll run out of memory for sure. No GC can fix that.
HTH,
-Paul.
------------------
Get Certified, Guaranteed!
http://pages.about.com/jqplus
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic