Why free memory on application quit?
Skorche Wrote:IO objects are a good example. They close the stream when they are collected. You don't want them to just leave it open because it may be a long time before the program exits.
Now consider that you've built some buffered IO object on top of that. If it was simply allowed to be GCed, it may still have data buffered that hasn't been written to the physical stream. If the stream was to be closed before the buffered data is written to it, it would corrupt the data.
That's a pretty good example. I was thinking that an IO buffer should be strictly handled by the runtime environment when things shut down, but there doesn't seem to be anything inherently wrong with letting objects finish up to prevent data corruption.
|Messages In This Thread|
Why free memory on application quit? - AnotherJake - Nov 25, 2008 07:44 AM
Possibly Related Threads...
|My game crashes on quit...||hangt5||17||7,973||
Jan 30, 2005 09:38 PM
Last Post: hangt5
|Carbon Apple quit Event troubles||deekpyro||3||5,414||
May 7, 2002 06:24 AM
Last Post: deekpyro