Skip to content

Conversation

@tveasey
Copy link
Contributor

@tveasey tveasey commented Jun 8, 2018

Backport of #115.

…stic#115)

Many of our current uses of shared pointer date from when not all our target platforms were
C++11 compliant and in particular move semantics weren't available. Now that they all are, we can
switch these to std::unique_ptr. This has a few advantages: i) it saves us 16 bytes (8 for the extra
pointer to the reference count and 8 for the reference count) per instance, ii) it avoids atomic
updates of the reference count, iii) it forces one to have the correct copy semantics in such
cases. For example, this showed up that we had an implicit shallow copy (not appropriate) on our
naive Bayes implementation and fixing this showed up a bug in restore. This also fixes an error in
memory accounting for shared pointers, which wasn't including the extra memory for the
reference count.
@tveasey tveasey merged commit 5e964e1 into elastic:6.x Jun 14, 2018
@tveasey tveasey deleted the port/115 branch December 13, 2018 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant