bluealloy / revm

Rust implementation of the Ethereum Virtual Machine.
https://bluealloy.github.io/revm/
MIT License
1.65k stars 555 forks source link

Memory increases a lot while using inspect_ref function #369

Closed mentalrob closed 1 year ago

mentalrob commented 1 year ago
let mut traceArena = self.with_database_at(block_request, |state, block| {
            let mut inspector = Inspector::default().with_steps_tracing();
            let block_number = block.number;
            let mut evm = revm::EVM::new();
            evm.env = self.build_call_env(request, fee_details, block);
            evm.database(state);
            let (ExecutionResult { exit_reason, out, gas_used, .. }, _) =
                evm.inspect_ref(&mut inspector);

            /*let traces = inspector.tracer.unwrap_or_default().traces;

            trace!(target: "backend", "trace call return {:?} out: {:?} gas {} on block {}", exit_reason, out, gas_used, block_number);
            traces*/
        }).await?;

The above code taken from foundry's anvil project. It seems evm.inspect_ref inflates memory too much.

mentalrob commented 1 year ago

It seems issue happens because of the inspector that foundry uses