Skip to content

Do not ignore error in os_free() when size == 0 #482

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

Conversation

ldorau
Copy link
Contributor

@ldorau ldorau commented May 10, 2024

Description

Do not ignore error in os_free() when size == 0.

Ref: #481

Checklist

  • Code compiles without errors locally
  • All tests pass locally
  • CI workflows execute properly

@ldorau ldorau force-pushed the Do_not_ignore_error_in_os_free_when_size_==_0 branch from 786689a to 93f94a9 Compare May 10, 2024 08:05
@ldorau ldorau changed the title Do not ignore error in os_free() when size == 0 Call umfMemoryProviderFree() with size from tracking provider May 10, 2024
@ldorau ldorau marked this pull request as ready for review May 10, 2024 08:08
@ldorau ldorau requested a review from a team as a code owner May 10, 2024 08:08
@ldorau ldorau force-pushed the Do_not_ignore_error_in_os_free_when_size_==_0 branch from 93f94a9 to 2bbd9fc Compare May 10, 2024 10:12
@@ -196,6 +196,7 @@ UBENCH_EX(simple, proxy_pool_with_os_memory_provider) {
}

umf_memory_pool_handle_t proxy_pool;
// the proxy pool requires the tracking provider to work correctly
Copy link
Contributor

Choose a reason for hiding this comment

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

The tracking provider is always required to work correctly :)
Would you like to say that tracking capabilities should be ON?

My general thoughts: the amount of features that depend on tracking capabilities is increasing. We should consider making the tracking provider always ON (remove the option that allows to disable it) or we need to check it at build/run time and return appropriate error. I vote for the first option (always unconditional ON).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree. Done: #485

@@ -238,8 +239,10 @@ UBENCH_EX(simple, disjoint_pool_with_os_memory_provider) {
disjoint_memory_pool_params.MinBucketSize = DISJOINT_POOL_MIN_BUCKET_SIZE;

umf_memory_pool_handle_t disjoint_pool;
umf_result = umfPoolCreate(umfDisjointPoolOps(), os_memory_provider,
&disjoint_memory_pool_params, 0, &disjoint_pool);
// disable the tracking provider to make it work faster (UMF_POOL_CREATE_FLAG_DISABLE_TRACKING)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we interested in performance without a tracking provider? But in real workloads tracking capabilities will be ON?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. Removed.
Done.

@@ -343,6 +348,15 @@ static umf_result_t trackingFree(void *hProvider, void *ptr, size_t size) {
umf_ba_global_free(value);
}

// umfMemoryProviderFree() should not be called with size == 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

But according to this PR umfMemoryProviderFree() for tracking provider can be called with size == 0.

Maybe a particular pool implementation should explicitly get the size from the tracker and call umfMemoryProviderFree() with the right size?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. New fix: #487

@ldorau ldorau mentioned this pull request May 10, 2024
3 tasks
ldorau added 2 commits May 10, 2024 14:03
umfMemoryProviderFree() should not be called with size == 0,
so use the size saved in the tracking provider in this case.

Signed-off-by: Lukasz Dorau <[email protected]>
@ldorau ldorau force-pushed the Do_not_ignore_error_in_os_free_when_size_==_0 branch from 2bbd9fc to 657b704 Compare May 10, 2024 12:04
@ldorau ldorau marked this pull request as draft May 10, 2024 12:05
@ldorau ldorau changed the title Call umfMemoryProviderFree() with size from tracking provider Do not ignore error in os_free() when size == 0 May 10, 2024
@ldorau
Copy link
Contributor Author

ldorau commented May 10, 2024

Replaced with #487

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