On Mon, Oct 26, 2015 at 12:24 PM, Daniel <danlrobertso...@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
strictly necessary.

We should take this point into account, but for a start the small
allocations are almost certainly to benefit from make_shared.
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to