ibatis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kai Grabfelder (JIRA)" <ibatis-...@incubator.apache.org>
Subject [jira] Commented: (IBATIS-540) Classloader memory leak because of ThreadLocal in ResultObjectFactoryUtil
Date Fri, 03 Oct 2008 11:08:44 GMT

    [ https://issues.apache.org/jira/browse/IBATIS-540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12636605#action_12636605

Kai Grabfelder commented on IBATIS-540:

doesn't this has a performance impact? What's the point of using the ThreadLocal if it is
cleaned just right after it has been set?

> Classloader memory leak because of ThreadLocal in ResultObjectFactoryUtil
> -------------------------------------------------------------------------
>                 Key: IBATIS-540
>                 URL: https://issues.apache.org/jira/browse/IBATIS-540
>             Project: iBatis for Java
>          Issue Type: Bug
>          Components: SQL Maps
>    Affects Versions: 2.3.3, 2.3.4
>            Reporter: Sylvain Laurent
>         Attachments: ibatis patch for classloader memleak.txt
> I'm using iBatis in a webapp with Spring and facing memory leaks upon redeployment oft
he webapp.
> I tracked the leaks to ibatis, where the class ResultObjectFactoryUtil has a static ThreadLocal
> The problem is that the value bound to a Thread through this ThreadLocal is never nullified,
and since the "factorySettings" is a static variable, the ThreadLocal instance is reachable
as long as the ClassLoader of the webapp is reachable. But since the FactorySettings instance
is bound to the Thread through a strong reference (see the JDK implementation of ThreadLocal
in ThreadLocalMap$Entry), the classloader is finally never collected...
> The solution is to always cleanup the ThreadLocal after usage (in SqlExecurtor)
> I attach a patch for iBatis 2.3.4 to this issue

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

View raw message