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

Fix DIIS memory leak #2350

Merged
merged 1 commit into from
Nov 12, 2021
Merged

Fix DIIS memory leak #2350

merged 1 commit into from
Nov 12, 2021

Conversation

JonathonMisiewicz
Copy link
Contributor

@JonathonMisiewicz JonathonMisiewicz commented Nov 10, 2021

Description

This PR fixes a memory leak which I inadvertently introduced myself when refactoring libdiis.

What I was trying to do was take heap memory and move it into the stack. You can't actually do that. So when I released my std::vector from the smart pointer and saved it to a class variable, the memory was not cleared on object delete because it was still heap memory and not stack memory. Mea culpa.

Checklist

  • Quick tests pass

Status

  • Ready for review
  • Ready for merge

@JonathonMisiewicz JonathonMisiewicz added the efficiency For issues about code in Psi needing a disturbing amount of time and/or memory. label Nov 10, 2021
Copy link
Member

@jturney jturney left a comment

Choose a reason for hiding this comment

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

Seems reasonable to use std::move like you did. LGTM

@hokru hokru merged commit 8926da6 into psi4:master Nov 12, 2021
@loriab loriab added this to the Psi4 1.5 milestone Nov 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
efficiency For issues about code in Psi needing a disturbing amount of time and/or memory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants