How can one `finalize` invocation break GC / JVM?
<p>While investigating <a href="http://stackoverflow.com/questions/13548809/why-threadpoolexecutor-behaves-differently-when-running-java-program-in-eclipse">Why ThreadPoolExecutor behaves differently when running Java program in Eclipse and from command line?</a> I wrote a test that throws a very strange OutOfMemoryError (max mem = 256 Mb)</p>

<pre><code>class A {
    byte[] buf = new byte[150_000_000];

    protected void finalize() {
        int i = 1;
    }
}

A a1 = new A();
a1 = null;
A a2 = new A();
</code></pre>

<p>comment out <code>int i = 1</code> and the test works. As far as I understand when <code>finalize</code> is empty HotSpot simply ignores it. But how can just one practically empty <code>finalize</code> invocation break GC / JVM?</p>
