How to increase JVM heap size

Possible duplicate:
How to increase JVM memory?

I get the following error:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at SQLite.Vm.step(Native Method) at SQLite.Database.get_table(Database.java:314) at SQLite.JDBC2z.JDBCStatement.executeQuery(JDBCStatement.java:120) at SQLite.JDBC2z.JDBCStatement.executeQuery(JDBCStatement.java:168) at TestData.readData(TestData.java:21) at TestData.main(TestData.java:41) 
+37
java
Jun 23 2018-11-11T00:
source share
6 answers

Listed below are several options for resizing the heap.

 -Xms<size> set initial Java heap size -Xmx<size> set maximum Java heap size -Xss<size> set java thread stack size 


 java -Xmx256m TestData.java 
+59
Jun 23 2018-11-11T00:
source share

Run the program using -Xms = [size] -Xmx -XX: MaxPermSize = [size] -XX: MaxNewSize = [size]

For example -

 -Xms512m -Xmx1152m -XX:MaxPermSize=256m -XX:MaxNewSize=256m 
+9
Jun 23 2018-11-11T00:
source share

Java command line options

 -Xms: initial heap size -Xmx: Maximum heap size 

if you use tomcat. Update CATALINA_OPTS environment CATALINA_OPTS

 export CATALINA_OPTS=-Xms16m -Xmx256m; 
+9
Jun 23 '11 at 10:50
source share

Using the -Xmx command-line -Xmx when calling java.

See http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html

+8
Jun 23 2018-11-11T00:
source share

Use -Xms1024m -Xmx1024m to control the size of your heap (1024 m is for demonstration only, the exact number depends on your system memory). Setting the minimum and maximum heap sizes to the same is generally best practice since the JVM does not require an increase in heap size at runtime.

+5
Jun 23 2018-11-11T00:
source share

-XmxSIZE

For example: -Xmx1024M

+2
Jun 23 2018-11-11T00:
source share



All Articles