-
Notifications
You must be signed in to change notification settings - Fork 35
add pool alloc counter ctl #1361
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
f5cd152
to
9ddd0d6
Compare
LGTM but formatting could be improved (empty lines, comments) |
7373f2f
to
2c34692
Compare
10b7d79
to
27bef2a
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.
Pull Request Overview
Adds a new allocation counter control (alloc_count
) to the UMF memory pool API and tests.
- Introduce
stats.alloc_count
to track active allocations in each pool - Register a new CTL subtree under
umf.pool.by_handle.stats.alloc_count
- Update all alloc/free/realloc APIs to atomically increment/decrement the counter, and add a parameterized test
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
test/poolFixtures.hpp | New ctl_stat_alloc_count test to verify allocation counts |
test/common/pool.hpp | Ignore aligned‐alloc support on Windows via #ifdef _WIN32 |
src/memory_pool_internal.h | Add umf_pool_stats_t and stats field to umf_memory_pool_t |
src/memory_pool.c | Implement CTL handler, wire up alloc_count , update alloc/free/realloc |
Comments suppressed due to low confidence (1)
src/memory_pool_internal.h:41
- [nitpick] Consider using a struct default initializer for
stats
(e.g.umf_pool_stats_t stats = {0};
) to avoid the explicitmemset
in the create path.
memset(&pool->stats, 0, sizeof(pool->stats));
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.
Good job well done
Description
Checklist