From f2ad79963c2dfba4f931bb231897133adcb8fcf1 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Tue, 28 Aug 2018 16:49:05 -0700 Subject: [PATCH] Add a comment about "dynamic" heaps. --- lib/execute/src/memory.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/execute/src/memory.rs b/lib/execute/src/memory.rs index fdd566c8d8..10069d95b3 100644 --- a/lib/execute/src/memory.rs +++ b/lib/execute/src/memory.rs @@ -63,6 +63,8 @@ impl LinearMemory { let new_bytes = (new_pages * PAGE_SIZE) as usize; if self.mmap.len() < new_bytes { + // If we have no maximum, this is a "dynamic" heap, and it's allowed + // to move. assert!(self.maximum.is_none()); let mut new_mmap = memmap::MmapMut::map_anon(new_bytes).unwrap(); new_mmap.copy_from_slice(&self.mmap);