title: Troubleshooting a java memory leak: finalization?
body: <p>I have a misbehaving application that seems to leak. After a brief profiler investigation, most memory (80%) is held by <code>java.lang.ref.Finalizer</code> instances. I suspect that finalizers fail to run. </p>
  
  <p>A common cause of this seems to be exceptions thrown from the finalizer. However, the javadoc for the <code>finalize</code> method of the <code>Object</code> class (see <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html" rel="noreferrer">here</a> for instance) seems to contradict itself: it states</p>
  
  <blockquote>
    <p>If an uncaught exception is thrown by the finalize method, the exception is ignored and finalization of that object terminates.</p>
  </blockquote>
  
  <p>but later, it also states that</p>
  
  <blockquote>
    <p>Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored. </p>
  </blockquote>
  
  <p>What should I believe (i.e., is finalization halted or not?), and do you have any tips on how to investigate such apparent leaks?</p>
  
  <p>Thanks</p>