diff --git a/src/interpreter/memory.rs b/src/interpreter/memory.rs index 171c3ab..c6a9a0d 100644 --- a/src/interpreter/memory.rs +++ b/src/interpreter/memory.rs @@ -49,12 +49,9 @@ impl MemoryInstance { .ok_or(Error::Memory(format!("initial memory size must be at most {} pages", LINEAR_MEMORY_MAX_PAGES)))?; let memory = MemoryInstance { - buffer: RwLock::new(Vec::with_capacity(initial_size as usize)), + buffer: RwLock::new(vec![0; initial_size as usize]), maximum_size: maximum_size, }; - if memory.grow(memory_type.limits().initial())? == u32::MAX { - return Err(Error::Memory(format!("error initializing {}-bytes linear memory region", initial_size))); - } Ok(Arc::new(memory)) }