Add a comment about "dynamic" heaps.

This commit is contained in:
Dan Gohman
2018-08-28 16:49:05 -07:00
parent d3fcb596b3
commit f2ad79963c

View File

@@ -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);