I am running a program in Eclipse(Windows) and need a relatively huge size of memory. Passing the -Xmx1500m
to the program seems not sufficient, while Eclipse does not permit me to assign a greater value. Having this configuration I get the out-of-memory exception.
I increased the virtual memory size to 40GB
. Isn't there a way to make this memory available to my program? I had easily done this in C#, for almost the same job.

- 40,646
- 13
- 77
- 103

- 687
- 3
- 7
- 13
-
you don't you set pass the argument for your program. – Subhrajyoti Majumder Feb 25 '13 at 06:39
-
you have to set argument for your program in eclipse. If you need more than 4GB memory, you need 64bit mashine and 64bit JVM. – neohope Feb 25 '13 at 06:42
-
You mean it is possible to pass the -Xmx30000m argument? – Masood Delfarah Feb 25 '13 at 06:43
6 Answers
you need to run a 64Bit vm to allow more than around -Xmx1500m
You may specify that in the Run-Settings for your program and do not need to apply it in the eclipse.ini which is for eclipse itself.
BUT: it is not a good idea to give the java-vm more memory than the real (physical, free) memory on your system is, because the GC will walk through many areas of the memory when it runs and that will lead to reading/writing memory from/to disk - means swapping. And this again will lead to a very bad performance. In this case you should think about what is consuming the memory and if there is a way to manage this data externally - on disk or some MemoryBuffers.

- 1,171
- 6
- 13
r u using 32 bit JVM or 64 bit? use 64 bit JVM. I am not sure about the size limitations on 64 bit , but definitely more than 32 bit.
try this: java -d64 -Xms512m -Xmx60g YourProgram
it sets 60gb as the max heap size.

- 917
- 1
- 12
- 24
-
1He is trying to run the program using eclipse and not on command prompt. This will no doubt work. – asifsid88 Feb 25 '13 at 06:50
-
32 Bit = 2^32 Bit = 4Gib 64 Bit = 2^64 Bit = 16EiB A singe exabit is 1.000.000.000 greater then 1 GB ;) – SomeJavaGuy Feb 25 '13 at 06:51
I think you need to increase the memory available to eclipse.
Modify -Xmx
option in the eclipse.ini
file (in a Windows machine).
Go to your eclipse root folder where eclipse.exe file is left and you will find eclipse configuration file ( eclipse.ini ) open that file and you need following changes

- 584
- 4
- 8