Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This widens the implementation of the
Heap
struct into aSegmentedHeap
, allowing multiple regions to be used for heap allocation. There is not, however, any fitting strategy - all allocations using allocate_first_fit will always use the first memory region, unless it fails. Allocations will cascade down the array of hole lists, failing to allocate when all regions fail to allocate.This also makes the assumption that memory regions are non-overlapping, so construction from a list of pointer+sizes is unsafe and that invariant is left to the consumer to enforce.
WIP as this does not extend the testing or fuzzing to the wider implementation, but should theoretically be fine as the changes do not actually change any of the allocation login in
hole.rs
.There is another change in there to make
HoleList::allocate_first_fit
return an Option type, which was done to make a functional pattern work inSegmentedHeap::allocate_first_fit
(i.e. usingIterator::filter_map
) but this can be reverted if we don't want that change mixed in with the other changes.