Pagini recente » Cod sursa (job #552405) | Cod sursa (job #1966954) | Cod sursa (job #2864400) | Cod sursa (job #64027) | 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();
}
}
}