Why do we have to increase the Java Heap?

前端 未结 4 1074
死守一世寂寞
死守一世寂寞 2021-01-19 17:26

I know how to set the Java heap size in Tomcat and Eclipse. My question is why? Was there an arbitrary limit set on the initial heap back when Java was first introduced so

4条回答
  •  独厮守ぢ
    2021-01-19 17:42

    I glanced by this the other day, but I'm not sure if this is what you want: -XX:+AggressiveHeap. According to Sun:

    This option instructs the JVM to push memory use to the limit: the overall heap is more than 3850MB, the allocation area of each thread is 256K, the memory management policy defers collection as long as possible, and (beginning with J2SE 1.3.1_02) some GC activity is done in parallel.

    Because this option sets heap size, do not use the -Xms or -Xmx options in conjunction with -XX:+AggressiveHeap. Doing so will cause the options to override each other's settings for heap size.

    I wasn't sure if this really meant what I thought it meant, though - that you could just let the JVM gobble up heap space until it is satisfied. However, it doesn't sound like it's a good option to use for most situations.

提交回复
热议问题