如何增加JVM的堆大小[重复]

时间:2020-12-29 17:20:27

Possible Duplicate:
How can I increase the JVM memory?

可能重复:如何增加JVM内存?

I am getting 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)

6 个解决方案

#1


65  

Following are few options available to change Heap Size.

以下是几个可用于更改堆大小的选项。

-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

#2


12  

Java command line parameters

Java命令行参数

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

if you are using Tomcat. Update CATALINA_OPTS environment variable

如果您使用的是Tomcat。更新CATALINA_OPTS环境变量

export CATALINA_OPTS=-Xms16m -Xmx256m;

#3


9  

Start the program with -Xms=[size] -Xmx -XX:MaxPermSize=[size] -XX:MaxNewSize=[size]

使用-Xms = [size] -Xmx -XX:MaxPermSize = [size] -XX:MaxNewSize = [size]启动程序

For example -

例如 -

-Xms512m -Xmx1152m -XX:MaxPermSize=256m -XX:MaxNewSize=256m

#4


9  

By using the -Xmx command line parameter when you invoke java.

通过在调用java时使用-Xmx命令行参数。

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

请参阅http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html

#5


5  

Use -Xms1024m -Xmx1024m to control your heap size (1024m is only for demonstration, the exact number depends your system memory). Setting minimum and maximum heap size to the same is usually a best practice since JVM doesn't have to increase heap size at runtime.

使用-Xms1024m -Xmx1024m来控制堆大小(1024m仅用于演示,确切的数量取决于您的系统内存)。将最小和最大堆大小设置为相同通常是最佳实践,因为JVM不必在运行时增加堆大小。

#6


2  

-XmxSIZE

-XmxSIZE

For example: -Xmx1024M

例如:-Xmx1024M

#1


65  

Following are few options available to change Heap Size.

以下是几个可用于更改堆大小的选项。

-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

#2


12  

Java command line parameters

Java命令行参数

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

if you are using Tomcat. Update CATALINA_OPTS environment variable

如果您使用的是Tomcat。更新CATALINA_OPTS环境变量

export CATALINA_OPTS=-Xms16m -Xmx256m;

#3


9  

Start the program with -Xms=[size] -Xmx -XX:MaxPermSize=[size] -XX:MaxNewSize=[size]

使用-Xms = [size] -Xmx -XX:MaxPermSize = [size] -XX:MaxNewSize = [size]启动程序

For example -

例如 -

-Xms512m -Xmx1152m -XX:MaxPermSize=256m -XX:MaxNewSize=256m

#4


9  

By using the -Xmx command line parameter when you invoke java.

通过在调用java时使用-Xmx命令行参数。

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

请参阅http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html

#5


5  

Use -Xms1024m -Xmx1024m to control your heap size (1024m is only for demonstration, the exact number depends your system memory). Setting minimum and maximum heap size to the same is usually a best practice since JVM doesn't have to increase heap size at runtime.

使用-Xms1024m -Xmx1024m来控制堆大小(1024m仅用于演示,确切的数量取决于您的系统内存)。将最小和最大堆大小设置为相同通常是最佳实践,因为JVM不必在运行时增加堆大小。

#6


2  

-XmxSIZE

-XmxSIZE

For example: -Xmx1024M

例如:-Xmx1024M