-
Notifications
You must be signed in to change notification settings - Fork 130
Interrupt and multicore safe allocator #469
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
base: main
Are you sure you want to change the base?
Conversation
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 is really great, but an allocator is going to need unit tests, just a few for this PR and we can follow up later as well.
I have a test suit that I used. |
Looking closer, I'm not sure how to proceed with adding tests. |
I don't think we have a place for that now, but we do want to get HIL testing in place, so at the very least I'd say hold on to it. We could commit here, but I'd be afraid it would bit rot with nothing running it. |
OK. I'm planning on using it for some stuff I'm doing, but I can just use my fork of microzig for that. I'll keep the PR open, and when there is a plan for building tests I'll add what's needed. |
7ef2634
to
a9bda42
Compare
There is an example program in |
456e0a0
to
7ccbf36
Compare
This PR supplies an implementation of a std.mem.Allocator.
It can be use to allocate memory from a specified buffer, or from the otherwise unused ram that follows the .bss section.
Unlike std.heap.FixedBufferAllocator it supports re-use of freed memory, coalescing adjacent freed blocks to lessen fragmentation.
It can be safely used from multiple cores or from an interrupt service routine.
It has been tested on RP2040, RP2350 (both amd and riscv) and on an esp-c3.