-
Notifications
You must be signed in to change notification settings - Fork 88
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 leak-prone CustomData in stdMem interface. #1001
base: devel
Are you sure you want to change the base?
Conversation
CLANG-FORMAT TEST - FAILED (on last commit): |
CMAKE-FORMAT TEST - PASSED |
give ownership of `CustomData` to `CustomRequest` and `CustomResponse` classes.
CMAKE-FORMAT TEST - PASSED |
CLANG-FORMAT TEST - PASSED |
This change does affect a couple places in sst-elements. I have a branch with the required changes ready to go, assuming this PR is successful. |
Status Flag 'Pre-Test Inspection' - - This Pull Request Requires Inspection... The code must be inspected by a member of the Team before Testing/Merging |
Does this compile with the current sst-elements/devel branch and pass the tests in that repo? If not, it will fail testing. |
It does not. There are a couple lines of code in Miranda and MemHierarchy that use |
I agree with the idea, it would be better to have the CustomRequest/Response explicitly take and hand off ownership including responsibility for delete. And if memH or any other elements are currently leaking CustomData, we need to fix that regardless. But, because this is a breaking change in the sst-core API, we're evaluating what we need to do for backwards compatibility. |
Cool, I understand that the breaking change is undesirable. We caught this in our codebase and the giving responsibility to CustomRequest/Response ended up being a simpler matter than following the Data objects and adding logic to various handlers to decide whether a delete needs to occur. I'll continue to watch for updates, please let me know if there is anything additional requested/needed to get this pulled in. |
Thanks. We'll get this in once we figure out how to phase it in without breaking things. Feel free to propose a way to do that if you think of one. Related, in digging through memH, it looks like there is a potential memory leak of CustomData in its own internal events, so I will fix that. |
I have given this a little bit of thought and I think the following steps comprise a roadmap that doesn't break anything along the way. First, we can try deleting To make the change to a unique_ptr:
|
Use
std::unique_ptr
to give ownership ofCustomData
to theCustomRequest
andCustomResponse
classes.Ensures that the
CustomData
will have it's destructor called without becoming unreachable. (#1000)