Actions
Support #3488
closedJava Heap Space in transformer.transform (Over time, not a single request)
Status:
Closed
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2017-10-17
Due date:
% Done:
0%
Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
Description
We are currently having a problem of Java Heap Space and the log shows the problem is when the transofrm method is called.
Resuming our implemetation is something like this:
Transformer transformer = cachedXSLT.newTransformer();
String strXMLInput = this.toString();
StringReader xmlReader = new StringReader(strXMLInput);
transformer.transform(new StreamSource(xmlReader), result);
Where cachedXSLT is a Template and result a javax.xml.transform.Result
The log shows this:
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Arrays.java:4138)
at java.util.Arrays.copyOf(Arrays.java:3870)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:119)
at java.io.PrintStream.write(PrintStream.java:454)
at sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:355)
at sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:425)
at sun.nio.cs.StreamEncoder.flushBuffer(StreamEncoder.java:138)
at java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:187)
at java.io.PrintStream.write(PrintStream.java:501)
at java.io.PrintStream.print(PrintStream.java:643)
at java.io.PrintStream.println(PrintStream.java:780)
at net.sf.saxon.StandardErrorListener.error(StandardErrorListener.java:210)
at net.sf.saxon.Controller.recoverableError(Controller.java:865)
at net.sf.saxon.trans.Mode.reportAmbiguity(Mode.java:593)
at net.sf.saxon.trans.Mode.getRule(Mode.java:257)
at net.sf.saxon.trans.RuleManager.getTemplateRule(RuleManager.java:160)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:329)
at net.sf.saxon.instruct.ApplyTemplates$ApplyTemplatesPackage.processLeavingTail(ApplyTemplates.java:527)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:317)
at net.sf.saxon.instruct.ApplyTemplates$ApplyTemplatesPackage.processLeavingTail(ApplyTemplates.java:527)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:317)
at net.sf.saxon.instruct.ApplyTemplates.apply(ApplyTemplates.java:210)
at net.sf.saxon.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:174)
at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
at net.sf.saxon.instruct.Choose.processLeavingTail(Choose.java:686)
at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
at net.sf.saxon.instruct.Instruction.process(Instruction.java:93)
at net.sf.saxon.instruct.ElementCreator.processLeavingTail(ElementCreator.java:296)
at net.sf.saxon.instruct.Block.processLeavingTail(Block.java:556)
at net.sf.saxon.instruct.Template.applyLeavingTail(Template.java:203)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:345)
at net.sf.saxon.instruct.ApplyTemplates.defaultAction(ApplyTemplates.java:378)
at net.sf.saxon.instruct.ApplyTemplates.applyTemplates(ApplyTemplates.java:333)
at net.sf.saxon.Controller.transformDocument(Controller.java:1807)
at net.sf.saxon.Controller.transform(Controller.java:1621)
Analysing the heap its shown that the heap is occupied mostly by ByteArrayOutputStream
My question is: Does transform keep any cache or anything that the garbage colector is not able to grab?
Please register to edit this issue
Actions