title: Java CMS garbage collection min heap
body: <p>In few of my services when checking the heap dump I am seeing <code>java.lang.ref.finalizer</code> taking up almost all space. There are thousands of instances of finalizer class in histogram.
  (I don't use finalize() method in code or 3rd party libraries)</p>
  <p><strong>My GC flags :</strong> <code>-XX:+UseConcMarkSweepGC -Xms7168m -Xmx7168m -XX:NewRatio=3</code></p>
  <p>While understanding the garbage collection mechanism I am having few queries.</p>
  <p><strong>Statement 1 :</strong>  If we set both the initial and maximum values of the heap as equal, the GC becomes slightly more efficient, because it never needs to figure out whether the heap should be resized.</p>
  <p><strong>Statement 2 :</strong> The JVM starts a concurrent cycle based on the occupancy of the heap. When it is
  sufficiently full, the JVM starts background threads that cycle through the heap and
  remove objects</p>
  <p>If we go with <code>Statement2</code> first, then it would mean that in my case where minHeap = maxHeap, the JVM won't start garbage collection for a long time, as the initial heap size itself is larger.</p>
  <p><em><strong>Question :</strong></em> Won't this make GC more inefficient contradicting <code>Statement1</code>, and in turn also cause memory error which I am facing (mentioned in the beginning), where too many objects are left in the heap to be GC collected for a long time and in turn filling up memory, to an extent where a Full GC is not happening?</p>