mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-05-24 13:11:34 +00:00
commit
7803faaa74
@ -49,12 +49,9 @@ impl MemoryInstance {
|
|||||||
.ok_or(Error::Memory(format!("initial memory size must be at most {} pages", LINEAR_MEMORY_MAX_PAGES)))?;
|
.ok_or(Error::Memory(format!("initial memory size must be at most {} pages", LINEAR_MEMORY_MAX_PAGES)))?;
|
||||||
|
|
||||||
let memory = MemoryInstance {
|
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,
|
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))
|
Ok(Arc::new(memory))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user