[英]Java out of memory on 64-bit jvm
I have got a problem. 我有一个问题。 My program is really big and java is throwing OutOfMemoryException.
我的程序很大,java抛出OutOfMemoryException。 In
.bat
file, I have got the following: 在
.bat
文件中,我得到了以下内容:
java -server -Dfile.encoding=UTF-8 -Xmx1500m -Xbootclasspath/p:../libs/l2ft.jar -cp config/xml;../libs/*; l2ft.gameserver.GameServer
Java is using 6 GB of my RAM, next 6 GB is not used. Java正在使用6 GB的RAM,接下来的6 GB未使用。
I typed System.getProperty("sun.arch.data.model");
我输入了
System.getProperty("sun.arch.data.model");
and it says that I am using 64-bit JVM. 它说我正在使用64位JVM。
You have set the maximum heap size to 1500m and while the JVM can use a little more than that ~200 MB, that's all you limited the process to. 您已将最大堆大小设置为1500m,而JVM可以使用的内存量多于200MB,但这仅是您将过程限制的范围。
Try instead to limit your progress to around 5 GB. 尝试将进度限制为大约5 GB。 (You want to leave some memory for overhead and the OS)
(您想为系统开销和操作系统保留一些内存)
-mx5g
Make the options before Xbootclasspath
this: 在
Xbootclasspath
之前进行以下选择:
java -XX:MaxPermSize=512m -server -Dfile.encoding=UTF-8 -Xmx8g -XX:+UseCompressedOops
This will make it use more memory and will also make sure it uses as little memory as possible to address the objects in a 64bits machine. 这将使其使用更多的内存,并确保它使用尽可能少的内存来寻址64位计算机中的对象。
The -XX:MaxPermSize=512m
makes the perm gem space larger (which you will probably need as you're using a lot of heap memory) and the -XX:+UseCompressedOops
will make it use 32bits addressing for objects, instead of 64bits, as a 8gb heap can be correctly addressed with 32bits, so it makes you use less memory for allocating objects. -XX:MaxPermSize=512m
使烫发宝石空间更大(当您使用大量堆内存时可能会需要),而-XX:+UseCompressedOops
将使对象使用32位寻址,而不是-XX:+UseCompressedOops
位,因为8gb堆可以用32位正确寻址,所以它使您使用更少的内存来分配对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.