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.
Asked
Active
Viewed 265 times
0
-
Reading "files" I suspect you're loading multiple gapps in the same java application - something that is rarely needed. dedek's advice is good, but I'd also suggest you review your architecture and decouple it so that you have different java apps for each gapp. – Yasen Mar 03 '15 at 16:55
1 Answers
0
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).
There are two things you can do:
Find a lower value of max heap size parameter that is still working.
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 .

dedek
- 7,981
- 3
- 38
- 68
-
I don't completely agree with 1. Usually gate creates lots of annotations for each document and although you're probably 'releasing' the docs, having some border amount of heap size would cause GC to run more often. Not to mention that if you set the heap size just enough for the gapp to load, a large document can cause an 'out of memory' error. – Yasen Mar 03 '15 at 16:50