-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fieldlocation shared ptr issues #35
base: develop
Are you sure you want to change the base?
Conversation
holds weak_ptr make_shared is wrong; it's not a factory just get shared_ptr
make_shared is wrong, just copy and swap/move it
removed make_shared
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #35 +/- ##
===========================================
+ Coverage 61.57% 61.66% +0.08%
===========================================
Files 274 275 +1
Lines 15234 15248 +14
Branches 1555 1555
===========================================
+ Hits 9381 9403 +22
+ Misses 5853 5845 -8 ☔ View full report in Codecov by Sentry. |
@@ -56,8 +64,14 @@ class FieldLocation : public eckit::OwnedLock, public eckit::Streamable { | |||
|
|||
virtual eckit::DataHandle* dataHandle() const = 0; | |||
|
|||
/// Create a (shared) copy of the current object, for storage in a general container. | |||
virtual std::shared_ptr<const FieldLocation> make_shared() const = 0; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With these changes we no longer need make_shared. So nuke it.
FieldLocationFactory::instance().build(uri.scheme(), uri, ref.offset(), ref.length(), remapKey); | ||
field = Field(std::move(*loc), timestamp_, ref.details()); | ||
delete (loc); | ||
std::shared_ptr<FieldLocation> loc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect to see a commensurate change to FieldLocationFactory.
If we are saying that the fieldLocations must be shared pointers, then we should create them as such. (Creating a shared pointer in 2 steps, with a raw pointer then a shared pointer object performs 2 memory allocations rather than 1.
as discussed