linked-list-allocator icon indicating copy to clipboard operation
linked-list-allocator copied to clipboard

Support using more than one memory region

Open GnomedDev opened this issue 1 year ago • 2 comments

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?

GnomedDev avatar Jul 25 '24 11:07 GnomedDev

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.

phil-opp avatar Jul 25 '24 20:07 phil-opp

@GnomedDev I saw this the other day whilst thinking about another unrelated feature I wanted, and I thought I had an easy architecture to support this. I put it in the PR https://github.com/rust-osdev/linked-list-allocator/pull/84 if you want to test it. I've tested it on Nintendo Switch / Aarch64 and it works fine in my toy MVP app.

pantsman0 avatar Oct 21 '24 03:10 pantsman0