|
Boost : |
Subject: Re: [boost] request for interest in a garbage collection library
From: Patrick Mihelich (patrick.mihelich_at_[hidden])
Date: 2009-04-20 17:50:03
Detecting cycles is the usual argument for garbage collection, but not the
only one. For example, it is useful for implementing persistent data
structures, where the memory dependencies quickly get very complicated.
These data structures are common (often required) in functional languages,
which is one reason those languages are garbage collected as a rule. In some
cases it is even possible for garbage collection to be faster than explicit
allocation and deallocation, as the allocation strategy can be extremely
simple (just bump a pointer).
I agree that RAII is an excellent solution to at least 90% of memory
management, but I think there is enough reason to investigate opt-in garbage
collection approaches for C++.
Patrick
On Mon, Apr 20, 2009 at 12:58 PM, Frank Mori Hess <frank.hess_at_[hidden]>wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Monday 20 April 2009, Simonson, Lucanus J wrote:
> > be too much of a burden, and if I wanted to be lazy I could use shared
> > pointers to do the reference counting instead of using a GC library with
> > equal extra effort. I don't want to be lazy, and I don't want to debug
>
> A garbage collector does have an advantage over shared_ptr reference
> counting,
> in that it can automatically detect cycles. Although, it does seem like it
> should be possible to detect shared_ptr cycles by keeping track of the
> memory
> regions owned by shared_ptrs and comparing them with the addresses of
> shared_ptr objects. Then you could build up a graph which could be checked
> for cycles and connectedness.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkns0+EACgkQ5vihyNWuA4VZPgCePlGKibaauHBkU+V7ntH+H/3n
> 6JUAn33H8zOSdgHfEUjPcbl1SSUWV5T5
> =wPWq
> -----END PGP SIGNATURE-----
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk