From aa39d64fc3f14ba381c5d244edb3a1f02805e521 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Mon, 12 Sep 2022 20:49:47 +0200 Subject: [PATCH] feat: add Memory::shrink_to_fit (#215) --- crates/revm/src/interpreter/memory.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/revm/src/interpreter/memory.rs b/crates/revm/src/interpreter/memory.rs index f0f6fe19a8..b5067bb07c 100644 --- a/crates/revm/src/interpreter/memory.rs +++ b/crates/revm/src/interpreter/memory.rs @@ -46,6 +46,11 @@ impl Memory { &self.data } + /// Shrinks the capacity of the data buffer as much as possible. + pub fn shrink_to_fit(&mut self) { + self.data.shrink_to_fit() + } + /// Resize the memory. asume that we already checked if /// we have enought gas to resize this vector and that we made new_size as multiply of 32 pub fn resize(&mut self, new_size: usize) {