简体   繁体   English

加载.gapp文件时GATE PersistenceManager.loadObjectFromFile outofmemory错误

[英]GATE PersistenceManager.loadObjectFromFile outofmemory error while loading .gapp files

While loading .gapp files from disc using PersistenceManager.loadObjectFromFile I got the, "Exception in thread "main" java.lang.OutOfMemoryError: Java heap space" Error. 使用PersistenceManager.loadObjectFromFile从光盘加载.gapp文件时,我得到了“线程中的异常”主“java.lang.OutOfMemoryError:Java堆空间”错误。 I increased the heap size to a maximum of 2048M and got the issue fixed. 我将堆大小增加到最大值2048M,并解决了问题。 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). 该错误表明您的门应用程序(加载的gapp文件)没有足够的内存。

There are two things you can do: 你可以做两件事:

  1. Find a lower value of max heap size parameter that is still working. 找到仍然有效的最大堆大小参数的较低值。

  2. Reduce the amount of memory needed. 减少所需的内存量。 For example by sharing some large objects (eg gazetteer lists) between gate applications. 例如,通过在门应用程序之间共享一些大对象(例如地名词典列表)。 It can be done using Factory.duplicate(Resource) . 可以使用Factory.duplicate(Resource) See eg slides from Developers GATE Course . 请参阅开发人员GATE课程中的幻灯片。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM