Mailinglist Archive: opensuse (4570 mails)

< Previous Next >
Re: [SLE] Clearing up the FUD on CLI/Mono
  • From: Randall R Schulz <rschulz@xxxxxxxxx>
  • Date: Sun, 13 Nov 2005 06:29:26 +0000 (UTC)
  • Message-id: <200511122229.20526.rschulz@xxxxxxxxx>
Steven,

On Saturday 12 November 2005 17:17, Steven T. Hatton wrote:
> ...
>
> Java's answer to memory leaks is garbage collection. C++'s answer is
> RAII. RAII requires you to think about what you are doing at a more
> fundamental level. That may take more work, but the end result is
> typically much better design.

I love answers of the form: If you were just omnicient, it wouldn't be a
problem.

GC is not an answer to "leaks" (which are bugs), it's a system of
automatic storage management. Storage management is ubitquitous in
programming. It's incumbent upon a language runtime to provide good
support for it. C++ says "I'll give you a built-in, uniform mechanism
to dynamically allocate storage, but you're on your own for keeping
track of every single allocation you make and if you don't give it back
to me, your program will slowly suffocate or take over the host on
which it's running." What kind of attitude is that for a language
designer to take toward the users?

C++ storage leaks are Murphy's Law in operation. The design of the
system affords a failure mode, so the occurrence of that failure mode
is predictable. Java designs the failure mode out at the language
level, hence it does not occur.

And just how does RAII and auto-pointers deal with cyclic structures?


> You may want to look at _The Design and Evolution of C++_, by Bjarne
> Stroustrup.
>
> Steven


Randall Schulz

< Previous Next >