Merge pull request #3349 from bytecodealliance/pch/limiter
add a hook to ResourceLimiter to detect memory grow failure
This commit is contained in:
@@ -524,9 +524,10 @@ pub unsafe trait LinearMemory: Send + Sync + 'static {
|
||||
|
||||
/// Grows this memory to have the `new_size`, in bytes, specified.
|
||||
///
|
||||
/// Returns `None` if memory can't be grown by the specified amount
|
||||
/// of bytes. Returns `Some` if memory was grown successfully.
|
||||
fn grow_to(&mut self, new_size: usize) -> Option<()>;
|
||||
/// Returns `Err` if memory can't be grown by the specified amount
|
||||
/// of bytes. The error may be downcastable to `std::io::Error`.
|
||||
/// Returns `Ok` if memory was grown successfully.
|
||||
fn grow_to(&mut self, new_size: usize) -> Result<()>;
|
||||
|
||||
/// Return the allocated memory as a mutable pointer to u8.
|
||||
fn as_ptr(&self) -> *mut u8;
|
||||
|
||||
@@ -36,7 +36,7 @@ impl RuntimeLinearMemory for LinearMemoryProxy {
|
||||
self.mem.maximum_byte_size()
|
||||
}
|
||||
|
||||
fn grow_to(&mut self, new_size: usize) -> Option<()> {
|
||||
fn grow_to(&mut self, new_size: usize) -> Result<()> {
|
||||
self.mem.grow_to(new_size)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user