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

port umm_malloc as new allocator #30

Merged
merged 1 commit into from
Jul 21, 2024
Merged

port umm_malloc as new allocator #30

merged 1 commit into from
Jul 21, 2024

Conversation

bhansconnect
Copy link
Collaborator

This is a direct port of the umm_malloc a version of malloc meant for embedded systems. By having a proper free list, we are able to track allocations much faster and avoid the performance bottlenecks that come from scanning bitset.

On top of that, this allocator will allocate to the space of best fit instead of the first location with enough space (this reduces fragmentation and memory pressure). Lastly, the allocator has a proper realloc algorithm that avoids a lot of problems with the naive implemention of malloc, copy, free. Overall, it should be a large perf and memory usage win.

It does add 4 bytes of overhead to each allocation. The old allocator had 1 bit of overhead for every 8 bytes allocated. So there is definitely more overhead. That said, the fragmentation and perf gains outweigh the costs in my opinion. Also, for wasm4, really only lists and large strings are allocated. Those tend to be large enough to pay for the overhead.

Copy link
Owner

@lukewilliamboswell lukewilliamboswell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @bhansconnect 😍

@lukewilliamboswell lukewilliamboswell merged commit 0bbe5a7 into main Jul 21, 2024
1 check passed
@lukewilliamboswell lukewilliamboswell deleted the umm_malloc branch July 21, 2024 00:30
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.

2 participants