Oh, I think I see what you're saying now. When the last reference goes out of scope is the only time it gets to make a decision about whether to deallocate the memory used for the variable. We don't necessarily know then whether the variable will be used again or not, or what for, so it's not a very good time to make that decision.
I'm not sure I'm convinced that deallocating would be a bad thing. Obviously, it depends on what the program is doing. I'd be tempted to take some kind of heuristic approach, but even then I'd want to do some testing to find where the cost/benefits are.
|Replies are listed 'Best First'.|
Re^5: No garbage collection for my-variables (possibilities)
by tye (Sage) on Sep 16, 2008 at 21:00 UTC