chaji99
chaji99

Reputation: 41

Exception in thread "something thread" java.lang.OutOfMemoryError: Java heap space. What can I do?

I have a following Error Message from my eclipse.

Exception in thread "th3" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Unknown Source)
    at java.util.Arrays.copyOf(Unknown Source)
    at java.util.ArrayList.ensureCapacity(Unknown Source)
    at java.util.ArrayList.add(Unknown Source)
    at Apeiron.FBM.Analysis.Clustering.Key.PatternClusterKey.Load(PatternClusterKey.java:260)
    at Apeiron.FBM.Analysis.UserBin.WaferUserDefineBin.CreatePatternClusterKey(WaferUserDefineBin.java:50)
    at Apeiron.FBM.Analysis.UserBin.UserDefineBin.Load(UserDefineBin.java:244)
    at Apeiron.FBM.Analysis.UserBin.WaferUserDefineBinDictionary.CreateUserDefineBin(WaferUserDefineBinDictionary.java:70)
    at Apeiron.FBM.Analysis.UserBin.UserDefineBinDictionary.Load(UserDefineBinDictionary.java:162)
    at Apeiron.MultiCore.OutputFileCreator.LoadDictionary(OutputFileCreator.java:357)
    at Apeiron.MultiCore.OutputFileCreator.run(OutputFileCreator.java:148)
    at java.lang.Thread.run(Unknown Source)

My Program of Apeiron is accomplished by four Threads & call a file that can be read with "org.w3c.dom.Document". That file becomes the object of WaferUserDefineBin.

So, I have done some experiments. The phenomena I figure out are following:
1. I think it is not about heap size. Maximum memory of my eclipse is 256M but My program use just 40M ~ 50M. and I have tried to expanse heap size to 512M from eclipse.ini file.

  1. It is problem of the file size that is changed WaferUserDefineBin. If I lessen size of the file, It doesn't happen Error.

  2. It is problem of Multi-Threading. It does good operation in single-thread even if Size of the file is big.

  3. Also, I use a Lock at region of reading the file but, Same Error occurs.

    I'm sorry for my poor English ability. Thanks a lot for your Help in advance.

Upvotes: 1

Views: 927

Answers (1)

Thilo
Thilo

Reputation: 262734

You need to increase the memory (heap size), but for your program, not for Eclipse itself.

You can find these settings in the "Run Configurations". There is a tab "Arguments" with an area "VM arguments". Put your -Xm there.

Upvotes: 3

Related Questions