tags:

views:

42

answers:

3

hi,

I have defined -Xmsx 1.3GB in the java VM parameters and my Eclipse does not allow more than this, when running the application I got the below exception:

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

What can I do?

+1  A: 

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?

Peter Lawrey
I didn't put any parameters, which parameter do you suggest to put in order to solve this problem?
Tamir
The VM argument used to run your application rather than VM arguments used to run eclipse.
Peter Lawrey
A: 

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.

kasten
I wouldn't do that when launching an application from within a maxed out Eclipse (i.e. with -Xmx1300m), as the OP is doing. You are liable to push the machine into VM thrashing.
Stephen C
+1  A: 

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.

Stephen C