Pagini recente » Cod sursa (job #243292) | Cod sursa (job #3187702) | Cod sursa (job #343093) | Cod sursa (job #431305) | Cod sursa (job #1376309)
import java.util.concurrent.atomic.AtomicInteger;
public class Main {
// Not actually necessary for the leak - keeps track of how many Hydras there are, so we know when they're all gone
public static AtomicInteger count = new AtomicInteger(0);
public Main() {
count.incrementAndGet();
}
protected void finalize() {
new Main();
new Main();
count.decrementAndGet();
}
public static void main(String[] args) throws InterruptedException {
new Main();
while (Main.count.get() > 0) {
// Prevent leaks ;-)
System.gc();
System.runFinalization();
}
}
}