On Thu, Nov 22, 2012 at 09:29:43PM +0100, Florian Weimer wrote:
> On 11/18/2012 07:06 PM, NightStrike wrote:
> 
> >What's wrong with std::shared_ptr?
> 
> The pointer needs two words, and the per-object overhead for the
> reference counts etc. is four words, if I'm counting correctly.
> 
> (Other forms of reference counting have less overhead, of course,
> but you were asking about std::shared_ptr.)


Actually, this observation may favor a real garbage collector. Marking GC as 
simple as ggc+gengtype usually have one (or a few) mark bits, so can consume 
only a few bits (or perhaps a byte in some mark array) per object. Copying GC 
could avoid consuming any more storage per object. Of course useless object may 
stay in memory for a while -until the GC deletes them or reuse their memory- 
but that observation is also true with traditional C++ "GC" techniques like 
shared_ptr .... An object may be freed later than what should be possible.

And some GC techniques are quite friendly with L1 or L2 caches on the processor 
chip.

Regards.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***

Reply via email to