Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-05-29 13:39:26

From: John Max Skaller <skaller_at_[hidden]>
> Greg Colvin wrote:
> > Also, decide whether being able to collect cycles is all that
> > important. We have gotten by with acyclic reference counting
> > pretty well.
> Speak for yourself. I'm writing a compiler, and there is
> NO WAY I would bother attempting it in C++. It is hard
> enough to design the algorithms, without having to
> continually try to figure out how to manage memory:
> the data structures the compiler uses are heavily cyclic.

Too many reliable compilers have been written in C for
me to think that memory management is a major obstable.

> As it stands, the Felix compiler may produce the wrong
> output .. but it has NEVER crashed.

So I would expect, knowing you and your standards
of craftsmanship.

> I use plenty of software which I guess is written
> in C++. Most of it core dumps regularly, probably
> due to memory management faults.

And I have written plenty of software in C++ that never
crashes. Without using garbage collection.

> I don't call that 'getting along pretty well',
> I call it a disgusing state of affairs.

Me too, but I don't blaim the tools for lack of
craftsmanship. And in fairness, it is difficult
to write Windows programs that don't crash no
matter what language you use.

> So does management, that requires code to be written in Java.

Java programs don't crash from memory errors, it's
true. Instead they deadlock from concurrency errors,
or chew up all available system resources, or just
do the wrong thing. I won't comment on managment.

> I've interfaced two systems that both use ref counting
> (Python and Tcl). It is very hard to get right.
> (Python in particular is quite tricky, since the rules
> are specialised for optimal performance for special
> cases).

So I would expect. I never said it was easy.

To be more specific, it is a garbage collecting
smart pointer whose value I am questioning. I'm
too close to the work to judge it's value. If
something like cyclic_ptr can make someone's job
easier then I am glad, but in my own work I have
mostly done well enough with a careful discipline
of ownership and occasional reference counting.

The only times I've needed garbage collection were
to implement java and Scheme interpreters. For
the Scheme interpreter performance was a non-issue,
and I coded up a little purpose-built collector
similar to cyclic_ptr. For the java machine we
have two memory management experts working full
time tuning and porting the collector, which is a
careful combination of conservative mark-sweep and
precise generational copying that needs to take
advantage of machine-level stack layout knowledge
to do it's job. This is some serious systems
programming, and cyclic_ptr would not at all fit
the bill. I suspect Python and Tcl use reference
counting as a way to avoid that kind of system
dependent work.

Boost list run by bdawes at, gregod at, cpdaniel at, john at