From: Minkoo Seo Date: 2006-05-30T20:39:11+09:00 Subject: Re: object.reference_count ------=_Part_3519_29819917.1148989148076 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Ruby doesn't have reference counting mechanism and it is good in itself. Reference counting can not solve the problem of circular reference. As an example, consider A -> B -> A situation where 'A -> B' means that A has a a variable that references B. In the example, A can not be freed because A is reference by B. B also can not be freed because it is referenced by A. Hence, things get complicated. Mark & sweep is an elegant solution to this problem which C++ doesn't have (but C++ of MS have garbage collection functionality). Sincerely, Minkoo Seo On 5/29/06, Jeff Rose wrote: > > C Erler wrote: > > On 28/05/06, Benjohn Barnes wrote: > >> > >> When I first came to Ruby, I'd been using C++'s Boost library, and > >> the smart pointer in that [1]. I noticed that Ruby didn't have a weak > >> pointer, and felt I'd find that a problem. I made a lot of use of > >> weak pointers in manager objects; they'd only manage something for as > >> long as other people made use of it. I've definitely not needed them > >> at all though, so maybe it's no big issue :) > >> > > > > For anyone who needs weak references: > > http://www.ruby-doc.org/stdlib/libdoc/weakref/rdoc/index.html > > > > Aha. This isn't what I was looking for, but I think it gets you the > same functionality without the book keeping of reference counting. > > Thanks, > Jeff > > ------=_Part_3519_29819917.1148989148076--