ticki %!s(int64=9) %!d(string=hai) anos
pai
achega
a651595317
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/block_list.rs

+ 2 - 1
src/block_list.rs

@@ -27,7 +27,8 @@ impl BlockList {
     pub fn alloc(&mut self, size: usize, align: usize) -> Unique<u8> {
         let mut ins = None;
 
-        for (n, i) in self.iter_mut().enumerate() {
+        // We run right-to-left, since new blocks tend to get added to the right.
+        for (n, i) in self.iter_mut().enumerate().rev() {
             let aligner = aligner(*i.ptr, align);
 
             if i.size - aligner >= size {