Skip to content
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

set control block at runtime #24

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

Conversation

philippe44
Copy link

This PR allows heap's control block to be dynamically calculated as a function of the size of the heap.

This is useful for embedded systems like espressif/esp-idf#7829 where there are a set of disparate size memory pools that cannot be combined together using tlsf_add_pool because they must be kept separated.

In such case, the control_t block has to be the size of the one for the largest heap and that can was a lot of (precious) memory for small heap, when much larger heaps exists. When creating a heap, the size of the expected heap can be added so that pools addition using tlsf_add_pool do not overflow the initially created control_block.

I don't think there is a large CPU overhead added by making some parameter runtime instead of compile-time, but I've not yet done benchmark.

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.

1 participant