468,113 Members | 2,124 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,113 developers. It's quick & easy.

Exception in thread "main"

I am getting the error: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space.
Mar 25 '20 #1

✓ answered by dev7060

The default memory is usually 64m. So I believe -Xmx256m would work well. More options to control memory use can be viewed by the java -X command.

4 1898
dev7060
413 Expert 256MB
Use the -xms and -xmx flags to allocate more memory.
Mar 25 '20 #2
okay i will try that.
Mar 25 '20 #3
dev7060
413 Expert 256MB
The default memory is usually 64m. So I believe -Xmx256m would work well. More options to control memory use can be viewed by the java -X command.
Mar 25 '20 #4
Ishan Shah
47 32bit
java.lang.OutOfMemoryError exception can also be thrown by native library code when a native allocation can't be satisfied. Following are the various cases when the OutOfMemory error might occur:

1) Due to Java Heap Space
2) When the GC Overhead limit exceeded
3) Permgen space is thrown
4) Metadata is allocated in native memory. if metaspace for class metadata is exhausted
5) Requested array size exceeds VM limit
Feb 1 '21 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Sharon | last post: by
2 posts views Thread by Jeff | last post: by
1 post views Thread by R.A.M. | last post: by
2 posts views Thread by =?Utf-8?B?RGFuZGFuIFpoYW5n?= | last post: by
3 posts views Thread by didacticone | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.