S
Serve La
Daniel Haude said:So it's essentially some reference counting scheme, right? I guess I'll
just stick with ref counting. Accomplishes the same thing, introduces very
little overhead (a dozen or two extra lines of code, maybe), and is
fully under my control.
No, reference counting is the naive approach. First of all it's slow plus it
will introduce problems when you put the code in different environments.
Think multithreaded and multiprocessor systems. I've just been in hell with
a reference counted system (the C++ stringstream class, not really the place
to discuss here). The code crashed totally completely and utterly randomly
on a hyperthreading processor. It turned out that the reference counting
caused the databus to lock up whenever you did a string operation. As it
happened, sometimes another processor was already pulling that line, but the
other processor went for it anyway and succeeded. It also succeeded in
crashing.
Ask in a java group about best schemes for garbage collection, there's been
a lot of research on it the last ten years.