Re: Garbage Collection - The Trash Begins To Pile Up
Walter Bright wrote:
1) if you don't have a 100% comprehensive test suite
2) for every path an exception might take through your code
3) for threading issues
4) for code you have to work with that cannot be instrumented
5) for code you have to work with that uses different memory management
conventions
I never have to deal with 1-3. I have a massive system (in terms of
scope, not lines of code) where am 100% certain that there are no
memory leaks. Anywhere. This is the true power of RAII. It allows
tuckability - you can make something, tuck it way, and be ready to bet
your left arm that there is nothing wrong with it in terms of memory
issues. You cannot have the same confidence with sloppy engineering,
which, IMO, is *most* of the impetus for wanting GC.
I'm not suggesting that C++ be made gc. There's too much water under
that bridge. What I'm doing is countering the false notions that GC is
only for the incompetent programmer, that correct explicit memory
management is easy, that GC has nothing to offer for elite programmers,
etc.
We are saying that C# people who complain that GC did not live up to
its promise are examples of the former type of programmer. As for the
elite programmers, if they want GC, one has to examine the situation.
I can think of two possibilities:
1. You are designing at system that has an inherent need for GC
2. You are ignoring that which C++ gives you, RAII and related
principles.
Again, it is our opinion that those who think they need GC on a
day-to-day basis, in general, are probably engineering systems poorly.
Anyone who has ever taught at the university level sees this phenomenon
in students - sometimes you have to structure the problems in such a
way to force the students to face that which they would really rather
not. I would recommend to the pro-GC people who would expect it to use
it in ordinary development to try to go for a full week (month) without
using operator new() or operator delete().
P.S. I've implemented malloc and friends, malloc debuggers, multiple
garbage collectors, garbage collector debuggers, and more custom
allocators than I can recall.
Based on your web site, I believe it. Your experience could be
valuable in explaining to the .NET crowd why GC is not meeting their
expectations.
-Le Chaud Lapin-
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]