Why free memory on application quit?

Moderator
Posts: 3,554
Joined: 2003.06
Post: #28
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.
Quote this message in a reply
Post Reply 


Messages In This Thread
Why free memory on application quit? - Josh - Nov 24, 2008, 09:52 AM
Why free memory on application quit? - sohta - Nov 24, 2008, 10:52 AM
Why free memory on application quit? - sohta - Nov 24, 2008, 11:11 AM
Why free memory on application quit? - sohta - Nov 24, 2008, 11:39 AM
Why free memory on application quit? - sohta - Nov 24, 2008, 02:58 PM
Why free memory on application quit? - sohta - Nov 24, 2008, 04:13 PM
Why free memory on application quit? - macnib - Nov 24, 2008, 05:12 PM
Why free memory on application quit? - Fenris - Nov 25, 2008, 04:16 AM
Why free memory on application quit? - DoG - Nov 25, 2008, 05:38 AM
Why free memory on application quit? - AnotherJake - Nov 25, 2008 07:44 AM
Why free memory on application quit? - mattz - Nov 25, 2008, 08:56 PM
Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  My game crashes on quit... hangt5 17 7,767 Jan 30, 2005 09:38 PM
Last Post: hangt5
  Carbon Apple quit Event troubles deekpyro 3 5,000 May 7, 2002 06:24 AM
Last Post: deekpyro