Page 1 of 1

java.lang.OutOfMemoryError: Java heap space

Posted: Wed Apr 16, 2025 2:42 pm
by Yuriy_1977
Hi!
I use:
*.ditamap transformation scenario - "DITA Map PDF - based on XSL-FO" and my customization.dir and custom DITA-OT.
I added topics to the *.ditamap step by step (over 400 pdf pages) and caught an error: java.lang.OutOfMemoryError: Java heap space.
So I edited parameter -Xmx<value> in my "oxygen23.1.vmoptions" file to the value 16000m (the "Copyright" tab in "About" window displayed the set value of the amount of memory), but it didn't help. Increasing the value of parameter "maxJavaMemory" in my scenario did not help either.
Here is the end of my console output log:

Code: Select all

      [fop] 	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284) [ant-launcher.jar:?]
      [fop] 	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101) [ant-launcher.jar:?]

BUILD FAILED
C:\builder\ditaot\build.xml:45: The following error occurred while executing this line:
C:\builder\ditaot\plugins\org.dita.pdf2\build.xml:140: The following error occurred while executing this line:
C:\builder\ditaot\plugins\org.dita.pdf2.fop\build_fop.xml:151: java.lang.OutOfMemoryError: Java heap space
	at org.apache.commons.io.output.ByteArrayOutputStream.needNewBuffer(ByteArrayOutputStream.java:127)
	at org.apache.commons.io.output.ByteArrayOutputStream.write(ByteArrayOutputStream.java:158)
	at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2147)
	at org.apache.commons.io.IOUtils.copy(IOUtils.java:2102)
	at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2123)
	at org.apache.commons.io.IOUtils.copy(IOUtils.java:2078)
	at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:721)
	at org.apache.fop.fonts.truetype.FontFileReader.<init>(FontFileReader.java:44)
	at org.apache.fop.pdf.PDFFactory.makeFontFile(PDFFactory.java:1214)
	at org.apache.fop.pdf.PDFFactory.makeFontDescriptor(PDFFactory.java:1149)
	at org.apache.fop.pdf.PDFFactory.makeFont(PDFFactory.java:870)
	at org.apache.fop.pdf.PDFResources.addFonts(PDFResources.java:137)
	at org.apache.fop.render.pdf.PDFDocumentHandler.endDocument(PDFDocumentHandler.java:184)
	at org.apache.fop.render.intermediate.util.IFDocumentHandlerProxy.endDocument(IFDocumentHandlerProxy.java:187)
	at org.apache.fop.render.intermediate.IFRenderer.stopRenderer(IFRenderer.java:295)
	at org.apache.fop.area.RenderPagesModel.endDocument(RenderPagesModel.java:265)
	at org.apache.fop.area.AreaTreeHandler.endDocument(AreaTreeHandler.java:342)
	at org.apache.fop.fo.FOTreeBuilder.endDocument(FOTreeBuilder.java:170)
	at net.sf.saxon.event.ContentHandlerProxy.close(ContentHandlerProxy.java:274)
	at net.sf.saxon.event.ProxyReceiver.close(ProxyReceiver.java:90)
	at net.sf.saxon.event.ReceivingContentHandler.endDocument(ReceivingContentHandler.java:219)
	at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown Source)
	at org.ditang.relaxng.defaults.RelaxNGDefaultsComponent.endDocument(Unknown Source)
	at org.apache.xerces.xinclude.XIncludeHandler.endDocument(XIncludeHandler.java:1196)
	at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(XMLDocumentScannerImpl.java:526)
	at org.apache.xerces.impl.XMLEntityManager.endEntity(XMLEntityManager.java:2022)
	at org.apache.xerces.impl.XMLEntityScannerXerces.load(XMLEntityScannerXerces.java:1762)
	at org.apache.xerces.impl.XMLEntityScannerXerces.skipSpaces(XMLEntityScannerXerces.java:1247)
	at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(XMLDocumentScannerImpl.java:1240)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:325)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.ditang.relaxng.defaults.RelaxDefaultsParserConfiguration.parse(Unknown Source)

Total time: 1 minute 57 seconds

The process finished with exit code: 1
Need help, advice :D .
Thanks in advance.

Re: java.lang.OutOfMemoryError: Java heap space

Posted: Wed Apr 16, 2025 2:48 pm
by Radu
Hi,
Oxygen 23 is in our end of life stage:
https://www.oxygenxml.com/eol.html
Other than that, the publishing works in a separate process which can have its maximum memory configured from the transformation scenario:

https://www.oxygenxml.com/doc/versions/ ... -arguments

Regards,
Radu

Re: java.lang.OutOfMemoryError: Java heap space

Posted: Wed Apr 16, 2025 3:25 pm
by Yuriy_1977
Thanks a lot for your reply, Radu!
Your advice solved the problem.