push reserves space, which pushes more blocks out of order
Created by: NilSet
alloc_fresh
gets new memory from a BRK, and expects to be able to push the blocks to the end of the pool. However this needs to reserve space, and when the pool does not have enough capacity, this can lead to a second BRK, whose excess memory will be pushed onto the pool before the first BRK's memory, making the pool out of order.
Backtrace showing recursive pushes:
#0 ralloc::bookkeeper::{{impl}}::push (
self=0x5555557f1350 <ralloc::allocator::ALLOCATOR::hd0ca4d222ed38541>,
block=Block = {...}) at src/bookkeeper.rs:452
#1 0x00005555555c060e in ralloc::bookkeeper::{{impl}}::reserve (
self=0x5555557f1350 <ralloc::allocator::ALLOCATOR::hd0ca4d222ed38541>,
needed=1) at src/bookkeeper.rs:521
#2 0x00005555555be940 in ralloc::bookkeeper::{{impl}}::push (
self=0x5555557f1350 <ralloc::allocator::ALLOCATOR::hd0ca4d222ed38541>,
block=Block = {...}) at src/bookkeeper.rs:467
#3 0x00005555555bca13 in ralloc::bookkeeper::{{impl}}::alloc_fresh (
self=0x5555557f1350 <ralloc::allocator::ALLOCATOR::hd0ca4d222ed38541>,
size=4, align=1) at src/bookkeeper.rs:332
#4 0x00005555555ba86c in ralloc::bookkeeper::{{impl}}::alloc (
self=0x5555557f1350 <ralloc::allocator::ALLOCATOR::hd0ca4d222ed38541>,
size=4, align=1) at src/bookkeeper.rs:176
#5 0x00005555555b775a in ralloc::allocator::{{impl}}::alloc (
self=0x5555557f1350 <ralloc::allocator::ALLOCATOR::hd0ca4d222ed38541>,
size=4, align=1) at src/allocator.rs:38
#6 0x00005555555b76c7 in ralloc::__rust_allocate (size=4, align=1)
at src/lib.rs:38
#7 0x00005555555b522b in collections::str::_$LT$impl$u20$collections..borrow..ToOwned$u20$for$u20$str$GT$::to_owned::h484039b44d7f71f1 ()
#8 0x00005555555ac70e in std::rt::lang_start::hfe4efe1fc39e4a30 ()
#9 0x000055555556275a in main ()