rust-osdev / linked-list-allocator

Apache License 2.0
218 stars 52 forks source link

Support using more than one memory region #83

Open GnomedDev opened 1 month ago

GnomedDev commented 1 month ago

The ESP32 (using esp-hal) has two memory regions that are usable, in the linker scripts as dram_seg and dram2_seg. Currently, this dram2_seg is unusable unless a user is to setup multiple heaps which is annoying to use. Can support be added to allow one Heap to both (or even more) regions of memory?

phil-opp commented 1 month ago

This was requested a few times, e.g: https://github.com/rust-osdev/linked-list-allocator/issues/40 and https://github.com/rust-osdev/linked-list-allocator/issues/16 . So I would be happy to merge a PR for this!

The implementation should not be too difficult. I think the deallocate function might even work for this, even though this behavior is not guaranteed. So adding a extend_with_region method should not be too difficult.