1

Possible Duplicates:
java.lang.OutOfMemoryError: Java heap space
How to deal with “java.lang.OutOfMemoryError: Java heap space” error (64MB heap size)

Could you please tell me how could I increase the java internal heap memory?

2
  • 9
    I can google that in less than 10 seconds. Try the -Xmx option. Commented Mar 25, 2011 at 15:23
  • Look and you shall find. Commented Mar 25, 2011 at 15:24

2 Answers 2

6

Use java -Xms<initial heap size> -Xmx<maximum heap size>

From the manual page:

This value must be a multiple of 1024 greater than 2 MB. Append the letter k or K to indicate kilobytes, the letter m or M to indicate megabytes, the letter g or G to indicate gigabytes, or the letter t or T to indicate terabytes.

Sign up to request clarification or add additional context in comments.

5 Comments

And how should I specify the dimensions between the brackets? Could you please give me an example?
I would had to that the permanent memory size : -XX:MaxPermSize=<perm heap size>
Like for ours webapps it curently: -Xms256m -Xmx1024m -XX:MaxPermSize=256m
Or use -ms and -mx which do the same thing are are standard (but poorly documented)
And how can I pass this command through eclipse IDE for one of my projects?
1

Probably you meant increasing the initial or maximum heap memory that the JVM can allocate. This can only be done at the startup time (i-e when your JVM starts up).

JVM accepts argument, often called jvmargs, that let you control various aspects of the JVM instance. For specifying minimum (starting) and maximum heap memory, you can use -Xms and Xmx jvmargs.

The actual process of specifying jvmargs vary depending on how are you launching your java program. If you are launching your program via command-line you can use following pattern:

java -Xms<initial> -Xmx<maximum> <mainClass> <args>

The size can be specified in MB or GB, for example:

java -Xms256M -Xmx2G ...

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.