How to Solve JAVA Error: “Too small initial heap”

Tomcat memory configuration

JAVA_ OPTS=”-server-Duser.timezone=GMT+08-Xms1024m-Xmx1024m-XX:PermSize=1024m-Xmn512m-XX:MaxPermSize=1024m-Djava.awt.headless=true”

-XMS: initialjavaheapsize initial stack size

-Xmx: maximum javaheapsize maximum stack size

(1) Highest priority: – XX: newsize = 1024m and – XX: maxnewsize = 1024m (2) times higher priority xmn1024m

(the default equivalent effect is: – XX: newsize = = – XX: maxnewsize = = 1024m) (3) the lowest priority: – XX: newratio = 2
the – XMN parameter is recommended because it is very concise, which is equivalent to setting newsize and maxnewsize at one time, and they are equal- XMN, together with the initial size of – XMS heap and the maximum size of – Xmx heap, has just determined the memory layout of the heap (it is estimated that the designer has also made three short parameters for the sake of brevity). In addition, the official article seems to say that – XMN was only supported by 1.4, but it should not be supported by JRE before 1.4

3. JVM Parameter Description:

-Server: as the first parameter, it must have good performance when there are multiple CPUs – XMS: initial size of javaheap. The default is 1/64 of the physical memory- Xmx: javaheap maximum. It is recommended to set it to half of the physical memory. Do not exceed physical memory- 20: Permsize: sets the initial size of the memory persistent area. The default value is 64M( I use visualvm.exe to view)

-20: Maxpermsize: sets the maximum size of the persistent memory area. The default value is 64M( I use visualvm.exe to view)

-20: Survivorratio = 2: the size of the survivor pool, which is 2 by default. If garbage collection becomes a bottleneck, you can try to customize the generation pool settings

-20: Newsize: the initial size of the newly generated pool. The default value is 2m

-20: Maxnewsize: the maximum size of the newly generated pool. The default value is 32m

If the heap size of the JVM is larger than 1GB, the value: – XX: newsize = 640m-xx: maxnewsize = 640m-xx: survivorratio = 16 should be used, or 50% to 60% of the total heap size should be allocated to the newly generated pool. Enlarge the new object area and reduce the number of fullgc

+20: Aggregate heap makes XMS meaningless. This parameter causes the JVM to ignore the Xmx parameter and eat up one g of physical memory and another g of swap- XSS: the stack size of each thread, “- xss15120” makes JBoss consume 15m of memory immediately every time it adds a thread, and the optimal value should be 128K, and the default value seems to be 512k.
XSS: the stack size of each thread, “- xss15120” makes JBoss consume 15m of memory immediately every time it adds a thread- verbose:gc Real world garbage collection information-x loggc:gc.log Specify the heap size of the garbage collection log file – XMN: younggeneration, which is generally set to 3 Quarter – XX: + useparnewgc: shorten the time of minor collection – XX: + useconcmarksweepgc: shorten the time of major collection. This option is more suitable when the heapsize is larger and the major collection time is longer

-20: Userparnewgc can be used to set parallel collection [multi CPU] – XX: parallelgcthreads can be used to increase the degree of parallelism [multi CPU] – XX: after setting useparallelgc, parallel clearing collector [multi CPU] can be used

error 1:

Java “toosmallinitialheap” error

The Xmx setting is small. Xmx is larger than – XMN

Similar Posts: