From 216f8ae87138bfe6d86edd1d560600632e327c4e Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Tue, 27 Jun 2017 15:21:10 +0300 Subject: [PATCH 1/2] fixed test lags --- src/interpreter/memory.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interpreter/memory.rs b/src/interpreter/memory.rs index 171c3ab..4afafe2 100644 --- a/src/interpreter/memory.rs +++ b/src/interpreter/memory.rs @@ -49,7 +49,7 @@ 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 { From b82592c03edcfd4964997bc9c3253d4bed201088 Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Tue, 27 Jun 2017 15:26:10 +0300 Subject: [PATCH 2/2] removed grow() call --- src/interpreter/memory.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/interpreter/memory.rs b/src/interpreter/memory.rs index 4afafe2..c6a9a0d 100644 --- a/src/interpreter/memory.rs +++ b/src/interpreter/memory.rs @@ -52,9 +52,6 @@ impl MemoryInstance { 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)) }