Skip to content
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

Patch two memory leaks that cause more leaks #685

Merged
merged 1 commit into from
May 8, 2024

Conversation

tepperly
Copy link
Member

@tepperly tepperly commented May 3, 2024

This PR plugs some memory leaks.

  • Patch two leaked pointers that are the root cause of multiple other leaks.

Overall, I would strongly recommend replacing most if not all the raw pointers with std::unique_ptr. std::unique_ptr has numerous benefits over raw pointers including:

  • automatic deletion when the pointer goes out of scope
  • automatic initialization to nullptr if it's not initialized explicitly
  • essentially no runtime or memory overhead compared to raw pointers

In the case of dir_cv_ and res_cv_, it's not clear to me why their pointers in the first place. IMHO, it seems like judicious use references instead of pointers could get rid of a variety of new/delete's or std::unique_ptr.

@tepperly
Copy link
Member Author

tepperly commented May 7, 2024

FYI, I don't believe I have permission to merge this. Someone from the project will need to shepherd this PR into the code if you agree with it.

@cnpetra cnpetra requested review from nychiang and cnpetra and removed request for nychiang May 8, 2024 02:34
@cnpetra
Copy link
Collaborator

cnpetra commented May 8, 2024

FYI, I don't believe I have permission to merge this. Someone from the project will need to shepherd this PR into the code if you agree with it.

is designed like that :) I just approved it.

@cnpetra cnpetra merged commit f338053 into LLNL:develop May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants