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

Release extended memory

Open Andy-Python-Programmer opened this issue 2 years ago • 1 comments

Add a way to release extended memory since it might be the case where one allocates a large amount of memory temporarily and then never needs the allocate such large amount of memory and releasing memory is a must in this situation. So, it would be reasonable to have a function such as release_memory which takes in a closure that internally the allocater calls if a hole is available at the end of the heap and the actual memory can be freed.

Other ways?

Another way to accomplish this without changes to the allocator to itself (but will be pain) is to make the caller free the memory itself and allocate a block of memory at that location on a page fault (on the next allocation if required). Like kernel-heap-on-demand-paging and inefficient :^).

Andy-Python-Programmer avatar Apr 03 '22 07:04 Andy-Python-Programmer

Sounds like a reasonable feature, I'm happy to merge a PR for this.

phil-opp avatar Apr 24 '22 13:04 phil-opp