Re: [Vala] use weak and var together



On Sat, 2009-01-10 at 13:16 -0800, Noah Gibbs wrote:
In addition to keeping a list of pointers to the object, you'll need
to traverse them in some way to find cycles and free storage with
cycles, but not pointed to by any non-cycles.  That pass should not be
done every time you break a pointer link because it can be very
expensive, just as garbage collection is.  You could do it
periodically, maybe every so many allocations or so many seconds --
but if you do that, you've basically written a garbage collector.

I agree. However, cyclic references are basically a trademark for
reference counting. It's relatively fast and easy to implement, but you
probably don't want use this in combination with a garbage collector as
the reference count other than zero is of no meaning to the collector.

  Remember that an object can be part of more than one cycle, and you
have to know how many of those refs are "cyclic" refs, and how many
(if any) aren't from cycles.  That's non-local knowledge.  What I'm
saying is that it's not an easy think to calculate, and there's a
reason that garbage collectors tend to be slow :-)

There are actually rather fast garbage collection algorithms out there.
The main reason I can think of why they still appear to be slow is that
in most cases they have to "stop the world" to do their processing.

Hans




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]