-
Notifications
You must be signed in to change notification settings - Fork 820
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
Generic Memory Pools #7418
Generic Memory Pools #7418
Conversation
1. Modify wolfSSL_CTX_load_static_memory() to use wc_LoadStaticMemory() instead of reimplementing it. 2. Initialize the pointers in wc_LoadStaticMemory() to null. 3. Whitespace changes.
1. Add the function wc_LoadStaticMemory_ex(), which is a generic version of wc_LoadStaticMemory(). 2. Modify wc_LoadStaticMemory() to call wc_LoadStaticMemory_ex() with the bucket lists. 3. Rename the function wolfSSL_load_static_memory() as wc_partition_static_memory(), make it static, move it higher in the file.
1. Add generic function wolfSSL_StaticBufferSz_ex() where one specifies the memory bucket list sizes and distribution. 2. Rewrote wolfSSL_StaticBufferSz() in terms of the new function. 3. Changed the list pointers on wc_LoadStaticMemory_ex() and wc_init_memory_heap() to be pointers to const.
1. Add checks for listSz against WOLFMEM_MAX_BUCKETS. 2. Use WOLFMEM_DEF_BUCKETS for the size when using the default memory descriptions. 3. Whitespace.
1. Make the function wolfSSL_GetMemStats() public.
ae7e091
to
0b5c83f
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.
I like the addition of being able to change the memory bucket sizes at run time and on creation!
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.
Looks good. Do we need to add API tests for these now that they are exposed?
5922649
1. Added some extra parameter checking to wc_LoadStaticMemory_ex(). 2. Added some extra parameter checking to wc_StaticBufferSz_ex(). 3. Rename some parameters and add some logging prints. 4. Some static functions have some parameter checking and they are only calling in one spot, remove it.
5922649
to
d239948
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.
All looks good to me. Remember documentation and test updates if you can squeeze them in here.
Setting up a heap initializes a mutex, maybe. It isn't cleaned up if needed. |
1. Add API test for function `wc_LoadStaticMemory_ex()`.
1. Add API for function `wc_UnloadStaticMemory()` which frees the mutex used by the static memory pool. 2. Update the `wc_LoadStaticMemory_ex()` test to free the static memory pool's mutex on each successful test case.
2db9c92
to
6be5526
Compare
Generic Memory Pools
wc_LoadStaticMemory_ex()
, updated support functions to work with it. Reimplementedwc_LoadStaticMemory()
in terms of the new API.wolfSSL_CTX_load_static_memory()
to usewc_LoadStaticMemory()
rather than reimplementing it.Fixes 17726
Testing
The code should work the same with and without the changes.
Checklist