当我运行多个不同的请求下面的代码,Java的元空间是越来越增加。
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;
}
能否请您解释一下什么是幕后发生的事情? 为什么java的元空间是越来越增加了吗?