From 197d7ebadd054f38e3bdc0f6a939eacc0bb4dbe8 Mon Sep 17 00:00:00 2001 From: Ahmed Hussein <50450311+amahussein@users.noreply.github.com> Date: Fri, 15 Nov 2024 15:31:01 -0600 Subject: [PATCH] Trigger GC at the beginning of each benchmark iteration (#1424) Signed-off-by: Ahmed Hussein (amahussein) Contributes to #1423 Trigger a GC at the beginning of each benchmark iteration --- .../org/apache/spark/rapids/tool/benchmarks/Benchmark.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/scala/org/apache/spark/rapids/tool/benchmarks/Benchmark.scala b/core/src/main/scala/org/apache/spark/rapids/tool/benchmarks/Benchmark.scala index a09f121ad..45ad3bdd4 100644 --- a/core/src/main/scala/org/apache/spark/rapids/tool/benchmarks/Benchmark.scala +++ b/core/src/main/scala/org/apache/spark/rapids/tool/benchmarks/Benchmark.scala @@ -104,6 +104,7 @@ class Benchmark( val gcTimes = ArrayBuffer[Long]() //For tracking maximum GC over iterations for (i <- 0 until minIters) { + System.gc() // ensures GC for a consistent state across different iterations val timer = new ToolsTimer(i) val memoryTracker = new MemoryMetricsTracker f(timer)