Skip to content

Commit

Permalink
comment explaining heap growth vs backing DS
Browse files Browse the repository at this point in the history
  • Loading branch information
joonazan committed Jun 4, 2024
1 parent 9c6d360 commit 635d7b4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/instruction_handlers/heap_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ fn store<H: HeapFromState, In: Source, const INCREMENT: bool, const HOOKING_ENAB
})
}

/// Pays for more heap space. Doesn't acually grow the heap.
/// That distinction is necessary because the bootloader gets u32::MAX heap for free.
pub fn grow_heap<H: HeapFromState>(state: &mut State, new_bound: u32) -> Result<(), ()> {
let already_paid = H::get_heap_size(state);
if *already_paid < new_bound {
Expand Down

0 comments on commit 635d7b4

Please sign in to comment.