Skip to content

Modernise manual memory management in range_image_border_extractor #3865

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shrijitsingh99
Copy link
Contributor

Solves #3801

@SergioRAgostinho SergioRAgostinho added changelog: enhancement Meta-information for changelog generation module: features needs: code review Specify why not closed/merged yet labels Apr 6, 2020
@SergioRAgostinho SergioRAgostinho self-requested a review April 6, 2020 07:45
@kunaltyagi kunaltyagi self-requested a review April 20, 2020 04:52
@kunaltyagi
Copy link
Member

@shrijitsingh99 Are you working on this or should we consider this ready for review?

@kunaltyagi kunaltyagi added needs: author reply Specify why not closed/merged yet and removed needs: code review Specify why not closed/merged yet labels Apr 21, 2020
@shrijitsingh99
Copy link
Contributor Author

@shrijitsingh99 Are you working on this or should we consider this ready for review?

Still working on it though would require some feedback, since haven't used smart pointers extensively.
Should we add a test case for this too?

@kunaltyagi kunaltyagi removed the needs: author reply Specify why not closed/merged yet label Apr 22, 2020
@shrijitsingh99 shrijitsingh99 marked this pull request as ready for review May 24, 2020 12:26
@stale
Copy link

stale bot commented Jun 23, 2020

Marking this as stale due to 30 days of inactivity. Commenting or adding a new commit to the pull request will revert this.

@stale stale bot added the status: stale label Jun 23, 2020
Copy link
Member

@kunaltyagi kunaltyagi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial, more on the implementation, not the methodology

@@ -0,0 +1,101 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Save 40 lines using SPDX license

delete[] surface_change_directions_;
surface_change_directions_ = blurred_directions;
delete[] surface_change_scores_;
surface_change_directions_.reset();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swap and reset instead?

delete[] surface_change_scores_;
surface_change_directions_.reset();
surface_change_directions_ = std::unique_ptr<Eigen::Vector3f[]>(std::move(blurred_directions));
surface_change_scores_.clear();
surface_change_scores_ = blurred_scores;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::move here

delete[] surface_change_scores_;
surface_change_directions_.reset();
surface_change_directions_ = std::unique_ptr<Eigen::Vector3f[]>(std::move(blurred_directions));
surface_change_scores_.clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to clear

@SergioRAgostinho
Copy link
Member

One comment before the review, the current implementation which adds unique_ptr, creates a potential API breakage by disabling copy operations in this class.

@kunaltyagi
Copy link
Member

That implies existing implementation has a potential double free bug, right? Can be resolved by adding a custom copy op. (Still breaks ABI)

@kunaltyagi kunaltyagi added the changelog: ABI break Meta-information for changelog generation label Jul 4, 2020
@stale
Copy link

stale bot commented Aug 3, 2020

Marking this as stale due to 30 days of inactivity. Commenting or adding a new commit to the pull request will revert this.

@stale stale bot added the status: stale label Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: ABI break Meta-information for changelog generation changelog: enhancement Meta-information for changelog generation module: features status: stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants