问题描述
使用PersistenceManager.loadObjectFromFile从光盘加载.gapp文件时,出现了线程主"中的异常" java.lang.OutOfMemoryError:Java堆空间"错误.我将堆大小增加到最大2048M,并解决了该问题.加载大量的.gapp文件时,是否有更好的替代方法来解决此问题.
While loading .gapp files from disc using PersistenceManager.loadObjectFromFile I got the, "Exception in thread "main" java.lang.OutOfMemoryError: Java heap space" Error.I increased the heap size to a maximum of 2048M and got the issue fixed. Is there a better alternative way to solve this issue when loading a large set of .gapp files.
推荐答案
如果您使用的是默认垃圾回收器,我认为不会.它需要最大堆大小参数才能进行工作.请注意,确实需要内存.该错误表明您的门应用程序(已加载的gapp文件)没有足够的内存.
I think not, if you are using the default garbage collector. It needs the max heap size parameter for its work. Note that the memory is really needed. The error says that there was not enough memory for your gate applications (loaded gapp files).
您可以做两件事:
-
找到一个仍在起作用的最大堆大小参数的较低值.
减少所需的内存量.例如,通过在Gate应用程序之间共享一些大对象(例如,地名词典列表).可以使用Factory.duplicate(Resource)
完成.参见例如幻灯片来自开发人员GATE课程.
Reduce the amount of memory needed. For example by sharing some large objects (e.g. gazetteer lists) between gate applications. It can be done using Factory.duplicate(Resource)
. See e.g. slides from Developers GATE Course .
这篇关于加载.gapp文件时,GATE PersistenceManager.loadObjectFromFile内存不足错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!