-
Notifications
You must be signed in to change notification settings - Fork 35
Add parameter to destroy upstream_memory_provider in finalize() #806
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
Add parameter to destroy upstream_memory_provider in finalize() #806
Conversation
why do we need this parameter? If the user creates an upstream provider, why can't he destroy it? |
In order to prevent a memory leak in our tests using the |
If it's only for tests then you can prevent the leak by just destroying the provider in pool_unique_handle_t. You just need to modify this line:
To be something like this:
|
8f263da
to
3be7e4a
Compare
|
But what if the user creates a memory pool with the Did I miss something? |
@vinser52 You are right. It seems this parameter is needed when |
@ldorau agree + please add test for this (for both cases - when UMF_POOL_CREATE_FLAG_OWN_PROVIDER is set to true and false) |
3be7e4a
to
9f6eb80
Compare
@bratpiorka Done |
Signed-off-by: Lukasz Dorau <[email protected]>
9f6eb80
to
7a210f0
Compare
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.
👍
@@ -898,6 +901,13 @@ static umf_result_t coarse_memory_provider_initialize(void *params, | |||
return UMF_RESULT_ERROR_INVALID_ARGUMENT; | |||
} | |||
|
|||
if (coarse_params->destroy_upstream_memory_provider && | |||
!coarse_params->upstream_memory_provider) { |
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.
Should the coarse provider always require the upstream provider to be specified?
What is the reason for not specifying the upstream provider? @bratpiorka what do you think?
P.S. I understand that it is out of scope for this particular PR.
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.
The coarse provider contains the fixed provider yet - in the case of the fixed provider the upstream provider is not required. The fixed provider will be moved to a separate provider and the upstream provider will be always required then.
Description
Add parameter to destroy
upstream_memory_provider
infinalize()
.Checklist