ashnakash at gmail.com
Mon Oct 26 10:05:31 PDT 2015
On Mon, Oct 26, 2015 at 12:24 PM, Daniel <danlrobertson89 at gmail.com> wrote:
> However, if make_shared is used and we're working with a single block,
> if we're also using weak_ptrs, if I'm correct the object will be destroyed
> once the last strong ref is deleted, but will not be deallocated until the
> last weak ref is deleted. I haven't seen many uses of weak_ptrs in LO, but
> if we have code using weak refs that could outlive all of the strong
> refs depending on your goals it could be better to stick with new + the
> shared_ptr constructor.
> Interesting point Daniel. Your point is relevant for large objects for
which weak_ptrs significantly outlive the shared_ptrs.
In that case there will be retention of the objects' memory beyond what is
We should take this point into account, but for a start the small
allocations are almost certainly to benefit from make_shared.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the LibreOffice