Reputation: 47
When I run the following code with multiple different requests, the java metaspace is getting increased.
public String applyXsltOnXml(String xmlString, String xsltInput) throws TransformerException {
String result = null;
try (StringReader stringReader = new StringReader(xmlString);
StringWriter writer = new StringWriter()) {
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer(new StreamSource(new StringReader(xsltInput)));
transformer.transform(new StreamSource(stringReader), new StreamResult(writer));
result = writer.toString();
}
return result;
}
Could you please explain what is happening behind the scenes ? why the java metaspace is getting increased ?
Upvotes: 0
Views: 149
Reputation: 163262
Xalan generates bytecode and I imagine that's what's occupying the metaspace.
Upvotes: 0