Java Heap space Issue - outOfMemory error when creating Word document

0
Hi,     I am facing out of memory error when generating the word document. We are working with large data. So single word document could have 50000 > records. I will attach the stacktrace for your reference. Is there any garbage collection generating this error ? Is anyone faced the same issue before ?    Thanks and regards, Vijayabharathi V java.lang.OutOfMemoryError: Java heap space     at java.base/java.lang.StringCoding.encodeUTF8_UTF16(StringCoding.java:910)     at java.base/java.lang.StringCoding.encodeUTF8(StringCoding.java:885)     at java.base/java.lang.StringCoding.encode(StringCoding.java:415)     at java.base/java.lang.String.getBytes(String.java:941)     at com.mendix.documentexporter.documents.FOBasedDocument.documentToXMLInputStream(FOBasedDocument.java:104)     at com.mendix.documentexporter.documents.XFCDocument.generateInputStream(XFCDocument.java:26)     at com.mendix.documentexporter.documents.FOBasedDocument.exportToInputStream(FOBasedDocument.java:82)     at com.mendix.documentexporter.DocumentGenerator.exportToInputStream(DocumentGenerator.java:111)     at com.mendix.documentexporter.DocumentGenerator.exportToIMendixObject(DocumentGenerator.java:78)     at com.mendix.documentexporter.actions.microflow.DocumentExportAction.execute(DocumentExportAction.scala:93)     at com.mendix.documentexporter.actions.microflow.DocumentExportAction.execute(DocumentExportAction.scala:18)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.$anonfun$execute$1(MicroflowObject.scala:32)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject$$Lambda$1948/0x0000000100cfc040.apply(Unknown Source)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.scala:29)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.$anonfun$executeAfterBreakingIfNecessary$2(MicroflowImpl.scala:172)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl$$Lambda$1946/0x0000000100cfa840.apply(Unknown Source)     at scala.Option.flatMap(Option.scala:283)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.scala:172)     at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.scala:119)     at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:46)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71)     at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:49)     at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:54)     at com.mendix.basis.actionmanagement.ActionManagerBase$1.execute(ActionManagerBase.java:147)     at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:26)     at com.mendix.basis.actionmanagement.ActionManagerBase.executeSync(ActionManagerBase.java:152)     at com.mendix.basis.actionmanagement.MicroflowCallBuilderImpl.execute(MicroflowCallBuilderImpl.scala:40)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.runMicroflow(ExecuteMicroflowAction.scala:76)     at com.mendix.webui.actions.client.ExecuteMicroflowAction.$anonfun$apply$3(ExecuteMicroflowAction.scala:42)     at com.mendix.webui.actions.client.ExecuteMicroflowAction$$Lambda$2215/0x0000000100dd3840.apply(Unknown Source)     at com.mendix.webui.actions.client.RegularClientAction$Helpers$.$anonfun$liftEither$1(RegularClientAction.scala:29)
asked
3 answers
2

Hi Vijay,

 

In Mendix we have an option to increase the Java heap memory. For that just go to the app setting and edit the existing configuration. As you could see the server tab and change the java heap option to custom from default. for more info just see attached picture here.

 

 

Hope this helps you!

 

Regards,

Yasar

answered
0

I hear your pain, would like to know if you found a solution.

answered
-1

Hi Vijay,

 

Run --> Run Configurations --> then select the project under maven build --> then select the tab "JRE" --> then enter -Xmx1024m

     or

  1. Open catalina.sh from tomcat/bin.

  2. Change JAVA_OPTS to

    JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1536m 
    -Xmx1536m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m 
    -XX:MaxPermSize=256m -XX:+DisableExplicitGC"

  3. Restart your tomcat


This should increase the memory heap for all the builds/projects. The above memory size is 1 GB. You can optimize the way you want.

 

Thanks

Hari

answered