Kengo's blog

Technical articles about original projects, JVM, Static Analysis and JavaScript.

ほんとに怖いfinalize

import java.util.concurrent.TimeUnit;

public class Laputa {
	public static void main(String[] args) {
		new Laputa();
		while (true) {
			try {
				System.gc();
				System.runFinalization();
				TimeUnit.MILLISECONDS.sleep(100);
			} catch (InterruptedException e) {
			}
		}
	}

	@Override
	public void finalize() {
		System.out.println("何度でも蘇るさ!");
		new Laputa();
	}
}