>> I was looking in the org.apache.xalan.lib.ExsltStrings class, and every >> call to tokenize references a cached static Document instance. Could >> this >> be causing all resulting all created Elements in every invocation of >> tokenize() to get retained in the JVM forever? It almost seems as such, >> given the number of these <token> elements piling up in my application's >> heap. > If it's cached at the Templates level, that's a bad implementation > decision, since it not only has to be synchronized, but it will exist for > as long as the Templates object exists.
I was trying to follow the code with what happens when the tokenize function returns its new NodeSet (aka NodeList) instance of <token> elements, and I think it goes into new XNodeSetForDOM((org.w3c.dom.NodeList)val, xctxt); new org.apache.xpath.NodeSetDTM(nodeList, xctxt); xctxt.getDTMHandleFromNode(node); DOM2DTM dtm = (DOM2DTM) getDTM(new javax.xml.transform.dom.DOMSource(root), false, null, true, true); synchronized public void addDTM(DTM dtm, int id, int offset) (in DTMManagerDefault) So there is a new DOM2DTM instance for every NodeSet returned by this function, and it would have been added to the DTMManager's m_dtm array. But I can't see how that side-effect NodeSet turned DOM2DTM will eventually be released by the DTMManager. Maybe it will never be, and that's the problem? So this is looking like I should find a way to not use the EXSLT tokenize function in a long-running application. If anyone has any insight into this effect, I'd greatly appreciate it. -- m@