Boost logo

Boost :

Subject: Re: [boost] Generic copy-on-write infrastructure in boost?
From: Edouard A. (edouard_at_[hidden])
Date: 2009-08-13 11:15:46


On Thu, 13 Aug 2009 08:01:24 -0700, Jason Dictos <jdictos_at_[hidden]>
wrote:
> Essentially what we want to do is have a heap ptr class that can be
copied
> around easily, without incurring the continual cost of duplicating the
heap
> space on each copy operation.
> [...]
> Really almost exactly like an STL string (Assuming COW was being used of
> course), except it would hold binary safe data.

References won't help in your case?

I may also point you to pool_allocator in boost, that's going to reduce
very much the cost of allocating and deallocating objects.

Someone in the mailing list pointed out quite correctly that COW is not a
very good idea on a 2009 system. I think in one of Sutter's book the COW is
benchmarked and it's slower than non-COW. As for memory usage reduction,
pool allocation is better suited.

-- 
EA

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