Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage Collection

 
J. Scott Smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can garbage collection ensure that a program will not run out of memory while running?
I know there is no way to know when it will begin, but does it have a safegaurd that will cause it to execute at some random time before the program runs out of memory?

 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact, it is guaranteed that it will run immediately if a memory request is made and insufficient memory is present to fill the request. However, there is no guarantee that it will be able to successfully free any memory - if all the objects in memory still have references to them, you're basically screwed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic