从javadoc上,发现的OutOfMemoryError发生的真正原因:
if more than 98% of the total time is spent in garbage collection and less than 2% of the heap is recovered, an OutOfMemoryError will be thrown
当98%的时间被用来GC,只有2%的heap空间被释放,就会抛出OutOfMemoryError
原文:
http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html#generations.performance