-
Notifications
You must be signed in to change notification settings - Fork 35
Add umf_ba_linear_pool_contains_pointer #222
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 umf_ba_linear_pool_contains_pointer #222
Conversation
Make it possible to allocate more than the initial pool size of the linear allocator. Signed-off-by: Lukasz Dorau <[email protected]>
Looks good. But can you explain why this will be needed for proxy pool? I still don't understand why we can't just detect recursion in malloc/free (globally, not per pointer) and then call appropriate function (base_alloc or umf*) |
If |
How can a pointer from the 'outside world' come from the base allocator? If a user calls 'free', the pointer has to come from a 'malloc' which means it has to be part of the umf pool, right? |
this code looks ok but please don't merge unless we need it |
Add umf_ba_linear_pool_contains_pointer(). It returns: - 0 if ptr does not belong to the pool or - size (> 0) of the memory region from ptr to the end of the pool if ptr belongs to the pool. It will be useful to implement realloc() in the proxy library. Signed-off-by: Lukasz Dorau <[email protected]>
f764b67
to
3e27c1e
Compare
@igchor Hundreds of pointers can come from the base allocator:
|
Closing for now - it will be reopened as a part of the pull request with the proxy library ... |
Add
umf_ba_linear_pool_contains_pointer()
.It returns:
ptr
does not belong to the pool orptr
to the end of the pool ifptr
belongs to the pool.It will be useful to implement realloc() in the proxy library.
Requires: