gpt4 book ai didi

java - 线程 "something thread"java.lang.OutOfMemoryError : Java heap space. 中的异常我该怎么办?

转载 作者:行者123 更新时间:2023-11-29 05:50:01 25 4
gpt4 key购买 nike

我的 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)

我的Apeiron程序是由四个线程完成的&调用一个可以用“org.w3c.dom.Document”读取的文件。该文件成为 WaferUserDefineBin 的对象。

所以,我做了一些实验。 我发现的现象如下:
1.我认为这与堆大小无关。 我的 eclipse 的最大内存是 256M,但我的程序只使用 40M ~ 50M。 我试图从 eclipse.ini 文件将堆大小扩展到 512M。

  1. 修改WaferUserDefineBin是文件大小的问题。 如果我减小文件的大小,就不会发生错误。

  2. 是多线程的问题。 即使文件大小很大,它在单线程中也能很好地运行。

  3. 此外,我在读取文件的区域使用了一个锁,但发生了同样的错误。

    对不起,我的英语能力很差。非常感谢您的提前帮助。

最佳答案

您需要增加内存(堆大小),但这是为了您的程序,而不是为了 Eclipse 本身。

您可以在“运行配置”中找到这些设置。有一个选项卡“Arguments”和一个区域“VM arguments”。把你的 -Xm 放在那里。

关于java - 线程 "something thread"java.lang.OutOfMemoryError : Java heap space. 中的异常我该怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14272182/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com