On Wednesday, May 28, 2003, at 13:04 America/Denver, Chuck Messenger wrote:


Larry Evans wrote:
Chuck Messenger wrote:
[snip]
collections, put them in object heirarchies, etc). This freedom should ideally apply both internally (within library L code) and most importantly, externally (in the code of users of library L). Crucially,
Would you require the users to use a smart pointer instead of a raw?
If not, then you're only option, that I can tell, is use a conservative
collector like Boehm's.

No -- users don't use pointers -- only objects. The objects each have one pimpl_ (which will be whatever "smart" type "we" - the uber-pointer framework designers - want), pointing to the underlying object.


Note: This is essentially a plain-vanilla Java-style object system which I am describing.

The consequence of mis-identification is
that you may fail to destroy some unused objects. If this leads to nothing worse than some leaked memory, then it's not a real problem -- it will be a vanishingly small amount of memory.
This is the justification for Boehm's conservative collector.
 http://www.hpl.hp.com/personal/Hans_Boehm/gc/

Does the Boehm collector likewise do a full scan of the heap? I assume so...

It marks all objects on the heap pointed to by the machine registers, and
all objects pointed to by those objects, and so on. It is conservative in
the sense that it cannot generally tell whether a register or memory cell
contains a pointer or an integer.


One big problem with this approach is that you end up having to scan all of your memory. This could (and for me, would) be an outrageous proposition, as only a tiny portion of memory relates to my object set. Most of it will be raw data (e.g. images, etc).

Boehm's collector includes functions for allocating pointer-free memory.


This is what Christopher's (alias= global rc mark-scan) algorithm does.
It's also what mark-sweep algorithms do, i.e. they have to mark all reachable
objects, and then scan thru the whole heap sweeping the unmarked into the
garbage collector. However, since this global scan is done, usually,
infrequently, the time isn't that big a factor, at least compared with the
updating of reference counts during each pointer copy.
That's why Boehm's gc should work faster than refcounting.

It does.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to