Pagini recente » Cod sursa (job #1259999) | Cod sursa (job #2676401) | Cod sursa (job #1165522) | Autentificare | 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();
}
}
}