Boost logo

Boost :

From: Michael H. Cox (mhcox_at_[hidden])
Date: 2000-08-09 06:01:31


FYI Thant,

  -----Original Message-----
  From: Thant Tessman [mailto:thant_at_[hidden]]
  Sent: Monday, August 07, 2000 12:05 PM
  To: boost_at_[hidden]
  Subject: Re: [boost] really smart pointers submission

  boost_at_[hidden] wrote:

> Date: Sun, 6 Aug 2000 10:54:34 -0600
> From: "Greg Colvin" <greg_at_[hidden]>
> Subject: Re: really smart pointers submission
>
> I had a little time this morning to study your code.
>
> I have three concerns so far:
>
> Multiple inheritance. It appears that your use of void* in RawHandle
> will not work for multiple inheritance.

  Yes, but there may be a fix for this. I didn't want to bother working it
  out until/unless there was interest. Currently an assert checks that
  multiple inheritance isn't being used in such a way as to break things.

> Pointer comparison. The contains() function is not portable, because
> pointers that are not into the same array are not comparable.

  Yes. According to a conversation on c.l.c++.m, this test will work on
  most "normal" hardware. There's another test that is supposedly
  portable, but it's much slower. I guess a compile-time switch is
  appropriate in any final version of this.

> Performance. It appears (I could be wrong) that your collection
> algorithm is not linear in the number of managed objects, but is of
> order N squared.

  Each object is checked against every pointer for containment. So it's
  O(M*N) where M is the number of pointers and N is the number of objects.
  I can't think of a direct way around this, but one idea to minimize this
  effect is to only check new objects (that is, objects that have been
  created or modified since the last collection). I'm not sure, but this
  may significantly complicate housekeeping. I'm very open to other
  ideas...

  To be honest, I'm just happy it works at all. I don't follow the C++
  literature religiously, but I haven't seen this problem addressed in a
  general way before.

  This type is more general than just C++. If you search the literature for
"garbage collection", you should probably find tons of literature. Also,
there is a product or company (can't remember which) called Great Circle
that does C++ garbage collection. You might check with some of their
product literature to get some ideas of what techniques they're using and
performance characteristics they have (or claim to have ;-).

  Keep up the good work. It would be nice to have a candidate for a
garbage-collected pointer for the C++ standard!

  Mike

  Note that Daryle Walker has done some work on the implementation. As
  soon as I get a chance to look through it, I'll resubmit it.

  -thant

----------------------------------------------------------------------------

--
----------------------------------------------------------------------------
--



Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk