File tree Expand file tree Collapse file tree
performance/src/main/java/org/apache/arrow/memory Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,18 +87,30 @@ public void setup() {
8787 }
8888
8989 /**
90- * Cleans up resources after each trial .
90+ * Cleans up buffers after each benchmark invocation .
9191 *
92- * <p>Closes all allocated buffers and the root allocator to prevent memory leaks and ensure
93- * accurate measurements in subsequent trials.
92+ * <p>Closes all allocated buffers to prevent memory leaks and ensure each iteration starts with
93+ * a clean slate. This is critical for the memory footprint benchmark which allocates many
94+ * buffers that would otherwise accumulate across warmup and measurement iterations.
9495 */
95- @ TearDown (Level .Trial )
96+ @ TearDown (Level .Invocation )
9697 public void tearDown () {
9798 for (int i = 0 ; i < NUM_BUFFERS ; i ++) {
9899 if (buffers [i ] != null ) {
99100 buffers [i ].close ();
101+ buffers [i ] = null ;
100102 }
101103 }
104+ }
105+
106+ /**
107+ * Cleans up the allocator after the trial completes.
108+ *
109+ * <p>Closes the root allocator to release all resources after all warmup and measurement
110+ * iterations are complete.
111+ */
112+ @ TearDown (Level .Trial )
113+ public void tearDownTrial () {
102114 allocator .close ();
103115 }
104116
You can’t perform that action at this time.
0 commit comments