commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "shishir sharma (JIRA)" <j...@apache.org>
Subject [jira] Created: (TRANSACTION-33) Possible Memory Leak
Date Wed, 02 Sep 2009 02:24:32 GMT
Possible Memory Leak
--------------------

                 Key: TRANSACTION-33
                 URL: https://issues.apache.org/jira/browse/TRANSACTION-33
             Project: Commons Transaction
          Issue Type: Bug
    Affects Versions: 2.0
         Environment: ubuntu hardy heron, tomcat, java 1.6
            Reporter: shishir sharma
            Priority: Blocker
             Fix For: 2.0


I have been using 2.0 version of library available mainly for hierarchical locking issues.
Apart from few other minor issues, it has been working pretty fine. I recently observed heap
size issues with my environments and while investigating that I found that my piece of code
using DefaultHierarchicalManager.java is among the top three heap consumers at that time.

Upon analysing the heap a bit more (and going through the code of transaction 2.0), I found
that we are not emptying a hashmap in RWLockManager.java. As a result, it holds onto references
and corresponding objects are never garbage collected. Please review the following patch and
let me know if it is ok or not.

Thanks,
Shishir
toshishirsharma[AT]gmail[DOT]com

=====  patch start =====
diff -rub branches/TRANSACTION_2/src/java/org/apache/commons/transaction/locking/RWLockManager.java
branches_mod/TRANSACTION_2/src/java/org/apache/commons/transaction/locking/RWLockManager.java
--- branches/TRANSACTION_2/src/java/org/apache/commons/transaction/locking/RWLockManager.java
  2009-09-01 20:05:29.000000000 -0500
+++ branches_mod/TRANSACTION_2/src/java/org/apache/commons/transaction/locking/RWLockManager.java
      2009-09-01 21:13:35.000000000 -0500
@@ -66,6 +66,7 @@
         removeUnsuedLocks();

         locksForThreads.remove(Thread.currentThread());
+        effectiveGlobalTimeouts.remove(Thread.currentThread());
     }

     protected void removeUnsuedLocks() {
diff -rub branches/TRANSACTION_2/src/java/org/apache/commons/transaction/locking/SimpleLockManager.java
branches_mod/TRANSACTION_2/src/java/org/apache/commons/transaction/locking/SimpleLockManager.java
--- branches/TRANSACTION_2/src/java/org/apache/commons/transaction/locking/SimpleLockManager.java
      2009-09-01 20:05:29.000000000 -0500
+++ branches_mod/TRANSACTION_2/src/java/org/apache/commons/transaction/locking/SimpleLockManager.java
  2009-09-01 21:13:05.000000000 -0500
@@ -108,6 +108,7 @@
         }

         locksForThreads.remove(Thread.currentThread());
+        effectiveGlobalTimeouts.remove(Thread.currentThread());
     }

 }
=====  patch end =====

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


Mime
View raw message