<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 26, 2015 at 12:24 PM, Daniel <span dir="ltr"><<a href="mailto:danlrobertson89@gmail.com" target="_blank">danlrobertson89@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">However, if make_shared is used and we're working with a single block,<br>
if we're also using weak_ptrs, if I'm correct the object will be destroyed<br>
once the last strong ref is deleted, but will not be deallocated until the<br>
last weak ref is deleted. I haven't seen many uses of weak_ptrs in LO, but<br>
if we have code using weak refs that could outlive all of the strong<br>
refs depending on your goals it could be better to stick with new + the<br>
shared_ptr constructor.<br><br></blockquote><div>Interesting point Daniel. Your point is relevant for large objects for which weak_ptrs significantly outlive the shared_ptrs.</div><div>In that case there will be retention of the objects' memory beyond what is strictly necessary.</div><div><br></div><div>We should take this point into account, but for a start the small allocations are almost certainly to benefit from make_shared.</div><div><br></div></div></div></div>