[rescue] Mozilla Firefox
abuse at cabal.org.uk
Fri Apr 23 10:13:44 CDT 2004
Joshua Boyd <jdboyd at jdboyd.net> wrote:
> On Thu, Apr 22, 2004 at 05:20:36PM -0400, Charles Shannon Hendrix wrote:
>> Only the very best programmers manage memory better than a well written
>> GC system.
> I'm not sure I entirely follow this. What's so hard or inefficient about
> free-ing something when you are done with it?
Depends on the program. For example, in C++, if you've got some code where
you have to have handles to a lot of resources (e.g. I need a socket, and a
pty, and a...) and any one of the allocations can fail, it's usually a lot
easier to wrap them in objects and let the language destroy the handles when
you bail and they all fall out of scope.
Sure, you *can* just go "oh, I've allocated these so far, so I'll free
them", but this is tedious and error-prone and makes the code longer and
harder to maintain. Much easier to let the language do this.
> Especially if the language happens to be VB (don't have child nodes in a
> tree point to their parents unless you want an amazing world of pain).
That's presumably due to using reference counting. Perl is similar, ditto
boost::shared_ptr<>. As long as you know what's going on and remember to
break the circular links, all is well.
Gravitation can not be held responsible for people falling in love.
- Albert Einstein
More information about the rescue