Skip to content

[disjoint] Set default parameters for disjoint pool #1377

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KFilipek
Copy link
Contributor

@KFilipek KFilipek commented Jun 13, 2025

Description

fixes #804

Checklist

  • Code compiles without errors locally
  • All tests pass locally
  • CI workflows execute properly
  • CI workflows, not executed per PR (e.g. Nightly), execute properly
  • New tests added, especially if they will fail without my changes
  • Added/extended example(s) to cover this functionality
  • Extended the README/documentation
  • All newly added source files have a license
  • All newly added source files are referenced in CMake files
  • Logger (with debug/info/... messages) is used
  • All API changes are reflected in docs and def/map files, and are tested

@KFilipek KFilipek self-assigned this Jun 13, 2025
@KFilipek KFilipek requested a review from a team as a code owner June 13, 2025 12:56
Comment on lines 1075 to 1080
*params = (umf_disjoint_pool_params_t){
.slab_min_size = 0,
.max_poolable_size = 0,
.slab_min_size = 64 * 1024, // 64K
.max_poolable_size = 2 * 1024 * 1024, // 2MB
.capacity = 0,
.min_bucket_size = UMF_DISJOINT_POOL_MIN_BUCKET_DEFAULT_SIZE,
.cur_pool_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.

Can you please update documentation with default values - for each set function just add info what is default setting

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check, I've updated details in setter functions.

.slab_min_size = 0,
.max_poolable_size = 0,
.slab_min_size = 64 * 1024, // 64K
.max_poolable_size = 2 * 1024 * 1024, // 2MB
.capacity = 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure if non zero default would be better (1?) @bratpiorka

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@KFilipek KFilipek requested review from lplewa and bratpiorka June 18, 2025 13:12
// This will use the default disjoint pool parameters
void *ptr = umfPoolMalloc(pool, 64);
ASSERT_NE(ptr, nullptr);
ret = umfPoolFree(pool, ptr);
Copy link
Contributor

Choose a reason for hiding this comment

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

with the current default params, the umfPoolFree() should not call provider free() - you could check it here by adding a static counter in free()

ASSERT_EQ(ret, UMF_RESULT_SUCCESS);

// Test allocation and deallocation with a different size
ptr = umfPoolMalloc(pool, 1024);
Copy link
Contributor

Choose a reason for hiding this comment

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

change 1024 to a size > max pollable size (e.g. 4MB) and check if the provider free is called at umfPoolFree

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.

Disjointpool seqfaults if parameters are NULL.
3 participants