You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by "John Connors (JIRA)" <xa...@xml.apache.org> on 2010/07/27 22:18:22 UTC

[jira] Commented: (XALANJ-2195) Memory leak in XMLReaderManager

    [ https://issues.apache.org/jira/browse/XALANJ-2195?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12892914#action_12892914 ] 

John Connors commented on XALANJ-2195:
--------------------------------------

When will this bug be resolved? It's hard to believe a problem of this magnitude hasn't been fixed for 4 years now.

> Memory leak in XMLReaderManager
> -------------------------------
>
>                 Key: XALANJ-2195
>                 URL: https://issues.apache.org/jira/browse/XALANJ-2195
>             Project: XalanJ2
>          Issue Type: Bug
>          Components: Xalan
>    Affects Versions: 2.7
>            Reporter: Marko Strukelj
>            Priority: Blocker
>         Attachments: gc-roots.jpg, retained-object-sizes.jpg, xalan-j2-2.6.0-xmlmemoryleak-tm2l.patch
>
>
> In class org.apache.xml.utils.XMLReaderManager 
> getXMLReader() method creates a new XMLReader (i.e. SAXParser) and stores it into ThreadLocal.
> releaseXMLReader() does not remove (set to null) ThreadLocal thus creating a permanent leak.
> Unfortunately the size of the cached Reader is typically dependent upon the size of the XML document you process (depends on implementation but this is the case with xerces SAXParser). In heavy load server environments with thread pools of tens and hundreds of threads the server sustains a significant memory leak (hundreds of megabytes - depending on the XML document sizes and number of threads in a thread pools).
> A fix is trivial:
> Put the following line at the end of releaseXMLReader method:
> m_readers.set(null);
> I wonder, why is reader stored in ThreadLocal in the first place?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-dev-help@xml.apache.org