Commit 213d817 1 parent c90ea4d commit 213d817 Copy full SHA for 213d817
File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -761,16 +761,23 @@ impl Cheatcode for stopAndReturnDebugTraceRecordingCall {
761
761
return Err ( Error :: from ( "nothing recorded" ) )
762
762
} ;
763
763
764
- // Revert the tracer config to the one before recording
765
- tracer. update_config ( |_config| record_info. original_tracer_config ) ;
766
-
767
764
// Use the trace nodes to flatten the call trace
768
765
let root = tracer. traces ( ) ;
769
766
let steps = flatten_call_trace ( 0 , root, record_info. start_node_idx ) ;
770
767
771
768
let debug_steps: Vec < DebugStep > =
772
769
steps. iter ( ) . map ( |& step| convert_call_trace_to_debug_step ( step) ) . collect ( ) ;
773
770
771
+ // Free up memory by clearing the steps if they are not recorded outside of cheatcode usage.
772
+ if !record_info. original_tracer_config . record_steps {
773
+ tracer. traces_mut ( ) . nodes_mut ( ) . iter_mut ( ) . for_each ( |node| {
774
+ node. trace . steps = Vec :: new ( ) ;
775
+ } ) ;
776
+ }
777
+
778
+ // Revert the tracer config to the one before recording
779
+ tracer. update_config ( |_config| record_info. original_tracer_config ) ;
780
+
774
781
// Clean up the recording info
775
782
ccx. state . record_debug_steps_info = None ;
776
783
You can’t perform that action at this time.
0 commit comments