Skip to content

Commit b297826

Browse files
committed
Fix benchmark test
1 parent d797d5f commit b297826

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

performance/src/main/java/org/apache/arrow/memory/MemoryFootprintBenchmarks.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)