开发者

application terminates on heapsize

开发者 https://www.devze.com 2023-01-21 07:48 出处:网络
I have defined -Xmsx 1.3GB in the java VM parameters and my Eclipse does not allow more than this, when running the appli开发者_开发技巧cation I got the below exception:

I have defined -Xmsx 1.3GB in the java VM parameters and my Eclipse does not allow more than this, when running the appli开发者_开发技巧cation I got the below exception:

Exception in thread "Thread-3" java.lang.OutOfMemoryError: Java heap space

What can I do?


You can set the maximum memory eclipse uses with -mx1300m or the like. This limitation will be because you are running 32-bit java on Windows. On a 64-bit OS, you won't have this problem.

However, its the maximum memory size you set for each application in eclipse which matters. What have you set in your run options in eclipse?


Your question is very unclear:

  • Are you running the application in a new JVM?
  • Did you set the -Xmx / -Xms parameters in the launcher for the child JVM?

If the answer to either of those questions is "no", then try doing ... both. (In particular, if you don't set at least -Xmx for the child JVM, you'll get the default heap size which is relatively small.)

If the answer to both of those questions is "yes", then the problem is that you are running into the limits of your hardware and/or operating system configuration:

  • On a typical 32bit Windows, a user process can only address a total 2**31 bytes of virtual memory, and some of that will be used by the JVM binaries, native libraries and various non-heap memory allocations. (On a 32 bit Linux, I believe you can have up to 2**31 + 2**30). The "fix" for this is to use a 64bit OS and a 64bit JVM.

  • In addition, a JVM is limited on the amount of memory that it can request by the resources of the OS'es virtual memory subsystem. This is typically bounded by the sum of the available RAM and the size of the disc files / partitions used for paging. The "fix" for this is to increase the size of the paging file / partition. Adding more RAM would probably be a good idea too.


You may want to look at the aggressive Heap option http://java.sun.com/docs/hotspot/gc1.4.2/#4.2.2.%20AggressiveHeap|outline It solved a similiar issue for me.

0

精彩评论

暂无评论...
验证码 换一张
取 消