score:1
Have a look at this for some common errors in setting the java heap. You've probably set the heap size to a larger value than your computer's physical memory.
You should avoid solving this problem by increasing the heap size. Instead, you should profile your application to see where you spend such a large amount of memory.
score:1
I think that it's around 2GB. While the answer by Pete Kirkham is very interesting and probably holds truth, I have allocated upwards of 3GB without error, however it did not use 3GB in practice. That might explain why you were able to allocate 2.5 GB on 2GB RAM with no swap space. In practice, it wasn't using 2.5GB.
score:5
I think a 32 bit JVM has a maximum of 2GB memory.This might be out of date though. If I understood correctly, you set the -Xmx on Eclipse launcher. If you want to increase the memory for the program you run from Eclipse, you should define -Xmx in the "Run->Run configurations..."(select your class and open the Arguments tab put it in the VM arguments area) menu, and NOT on Eclipse startup
Edit: details you asked for. in Eclipse 3.4
Run->Run Configurations...
if your class is not listed in the list on the left in the "Java Application" subtree, click on "New Launch configuration" in the upper left corner
on the right, "Main" tab make sure the project and the class are the right ones
select the "Arguments" tab on the right. this one has two text areas. one is for the program arguments that get in to the args[] array supplied to your main method. the other one is for the VM arguments. put into the one with the VM arguments(lower one iirc) the following:
-Xmx2048mI think that 1024m should more than enough for what you need though!
Click Apply, then Click Run
Should work :)
score:35
Yes, there is a maximum, but it's system dependent. Try it and see, doubling until you hit a limit then searching down. At least with Sun JRE 1.6 on linux you get interesting if not always informative error messages (peregrino is netbook running 32 bit ubuntu with 2G RAM and no swap):
peregrino:$ java -Xmx4096M -cp bin WheelPrimes
Invalid maximum heap size: -Xmx4096M
The specified size exceeds the maximum representable size.
Could not create the Java virtual machine.
peregrino:$ java -Xmx4095M -cp bin WheelPrimes
Error occurred during initialization of VM
Incompatible minimum and maximum heap sizes specified
peregrino:$ java -Xmx4092M -cp bin WheelPrimes
Error occurred during initialization of VM
The size of the object heap + VM data exceeds the maximum representable size
peregrino:$ java -Xmx4000M -cp bin WheelPrimes
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
(experiment reducing from 4000M until)
peregrino:$ java -Xmx2686M -cp bin WheelPrimes
(normal execution)
Most are self explanatory, except -Xmx4095M which is rather odd (maybe a signed/unsigned comparison?), and that it claims to reserve 2686M on a 2GB machine with no swap. But it does hint that the maximum size is 4G not 2G for a 32 bit VM, if the OS allows you to address that much.
Source: stackoverflow.com
Related Query
- Is there a maximum number you can set Xmx to when trying to increase jvm memory?
- Is there a limit on the number of lines of code you can put in an Eclipse java doument
- How can you set up Eclipse to remove trailing whitespace when saving a JavaScript file?
- Increase the maximum number of javadoc warnings when compiling with Ant
- Eclipse won't start with Xmx set to 1024m anymore, though there is enough memory
- I am trying to set MAX_HEAP memory to an odd number , but the heap is being set to the next even number
- Getting "CHECKOUT can only be performed on a version resource" when trying to commit using Eclipse subversive plugin
- In Eclipse, when debugging, is there an easy way to see a variable's total memory size?
- When using Eclipse with FindBugs can you mark a bug as not a bug and have it removed from the bug list?
- When in Debug mode in Java, is there anything like a Console where I can type commands?
- Can I set API level X attributes in my manifest when my minSdkVersion is less than X?
- Is there a python IDE that will tell you the type of a variable when you hover over it?
- When you get a stack trace in Eclipse with SDK classes in the stack, how can you see the SDK sources?
- How can I monitor how many threads and memory usage in my JVM or Eclipse?
- How can I set a breakpoint for when variable changes in Eclipse?
- How can I make PyDev autoformat the maximum number of characters per line?
- Can i increase the number of visible open file tabs in Eclipse
- Can you explicitly set the background color of a SWT Text widget to the default color?
- Is there a way to instruct Eclipse to off-load memory when minimized?
- How Do You Set Eclipse's Default Settings for When You Create New Workspaces?
- Are there any tools which can automate rebuilding of the project when ever there is a change in some part of code?
- adb got same serial number when two phone are connected on a pc. Can I change the serial number?
- Can you force eclipse to run/debug another project when a particular one is ran/debugged?
- java.lang.NullPointerException when trying to set EditText widget
- JVM terminates with exit code 14 when trying to launch Eclipse
- Is there a program that can tell you which class/method is being invoked
- Can Eclipse CDT formatter be set to keep one liners when reformatting?
- Is there a way to set a timeout period on a Minecraft client when connecting to a server? This is due to Eclipse debugging
- How can I set default class name using selenium webdriver when two panel have same class name
- Can the Eclipse GWT plugin be configured to warn when you use non-emulated methods
More Query from same tag
- Java classpath folder missing in project but exists in Windows directory structure for project
- eclipse (neon) Debugger: "Step into" and "Step Over" are like "Resume"
- How to output additional debugging information using Eclipse and Android JUnit
- Can't run app from Eclipse in my htc device
- How do I get a new branch to show up in Eclipse Git Remote Tracking?
- webview activity links not opens in browser
- Cannot create zip file in java using zip4j
- Eclipse doesn't stop at breakpoints
- Eclipse unable to find the css file for GWT binder
- Maximize code tab in eclipse shortcut
- Java BufferedWriter Save As operation
- Mercurial post-build commit in MPLAB (Eclipse)
- Wildfly in eclipse does not use heap params set in standalone.conf
- When i start tomcat in eclipse shows error java.lang.reflect.InvocationTargetException
- Configure Eclipse to use VS.Net shortcuts?
- How can I open encrypted sqlite database in Android?
- How to change Eclipse Console foreground color?
- database access plugin for eclipse
- Unable to open Eclipse (configuration area .. error)
- How to get the properties values those that are defined in the shell (bash) script file using Scala 2.11 code?
- How to config TestNG test-output folder to be inside Maven target folder?
- Android Activity Not found - never had before this error
- Motodev site hanging Eclipse check for updates
- Force eclipse to reload Python modules
- Can't bind to local 86XX for debugger
- eclipse / android project - file encoding issue while change package name
- how can i minimize the stack trace in eclipse java tomcat?
- Can't find class on path DexPathList
- Connecting to a MongoDB with Android in Eclipse
- Using Telegram API for Java Desktop App?