Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ private void loop() {
// transient; JVM crash is the signal we watch for
}
// loader + klass go out of scope here.
// Pace class loading so old-gen GC can reclaim ClassLoader
// instances before they accumulate across a long run.
try {
Thread.sleep(1L);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ private void loop() {
} catch (Throwable t) {
// transient; JVM crash is the signal we watch for
}
// Pace hidden-class generation so the GC can evict unloaded
// classes before they accumulate across a long run.
try {
Thread.sleep(1L);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public final class WeakRefWaveAntagonist implements Antagonist {

private static final int WAVE_SIZE = 10_000;
private static final int[] OBJECT_SIZES = {64, 256, 1_024, 4_096};
private static final long INTER_WAVE_MS = 200L;

private volatile boolean running;
private Thread waveDriver;
Expand Down Expand Up @@ -100,6 +101,15 @@ private void waveLoop() {

// Replace shared reference; weakRefs goes out of scope
currentWave = new ArrayList<WeakReference<byte[]>>();

// Pause between waves so concurrent GC can reclaim without being
// overwhelmed by back-to-back System.gc() calls.
try {
Thread.sleep(INTER_WAVE_MS);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
}
}
}

Expand Down
Loading