-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
mempool based on bget #5066
mempool based on bget #5066
Conversation
DMSG("Max memory usage increased to %zu", | ||
(size_t)pool->max_last_offset); | ||
} | ||
struct malloc_stats 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.
This code block should also be in CFG_WITH_STATS along with CFG_MEMPOOL_REPORT_LAST_OFFSET
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'll enable CFG_WITH_STATS from mk/config.mk
when CFG_MEMPOOL_REPORT_LAST_OFFSET=y
.
It seems I've mixed up which change should go into which commit. I'll fix that and force push. This needs to be rebased so I'll do that too. |
Updated |
|
Exports raw_{memalign,malloc,free,calloc,realloc}() and also adds raw_malloc_get_ctx_size(), raw_malloc_init_ctx(), raw_malloc_add_pool() and raw_malloc_get_stats(). This allows using the malloc functions to allocate with a independent memory pool. Acked-by: Sahil Malhotra <sahil.malhotra@nxp.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Instead of the old stack like internal memory allocator, use the raw malloc functions instead for more efficient memory usage. CFG_WITH_STATS is enabled automatically if CFG_MEMPOOL_REPORT_LAST_OFFSET is enabled to secure a new dependency in the code. Acked-by: Sahil Malhotra <sahil.malhotra@nxp.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Tags applied. Rebased on master to resolve a conflict. |
This relates to the issue #5022 and the recently merged PR #5065
Reply to #5022 (comment)
This PR attempts to do this. Note that I haven't tried to tune
MPI_MEMPOOL_SIZE
.The purpose of mempool is to be able to guarantee that temporary memory allocations will succeed during asymmetric cipher operations. As long as we return the memory allocated with mempool_alloc() we can use it in other functions too. There's a couple of examples of that in the code already. So the rule is: if you allocate memory with mempool_alloc() you should free it again before returning.