[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2200) Memory leak in AbstractBatcher with Generated Properties

Jay Paulsen (JIRA) noreply at atlassian.com
Mon Oct 30 22:22:05 EST 2006


Memory leak in AbstractBatcher with Generated Properties
--------------------------------------------------------

         Key: HHH-2200
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2200
     Project: Hibernate3
        Type: Bug

    Versions: 3.2.0.ga    
 Environment: Hibernate 3.2.0 GA;  Oracle 10g;  Java 1.5
    Reporter: Jay Paulsen



Using Hibernate 3.2 GA with Entity Manager and Annotations, I have a batch job that inserts several thousands of objects for a class with a @Generated property. The job results in a memory leak in the AbstractBatcher class.

The problem appears to be in the method processGeneratedProperties in AbstractEntityPersister. This method closes the result set for the generated property query and calls session.getBatcher().closeStatement() to close the statement instead of session.getBatcher().closeQueryStatement to close both the statement and the result set. The result is that even though the result set is closed, it is not removed AbstractBatcher's resultSetsToClose HashSet.

Even though the batch job commits and clears the session every 200 rows, over time the leaked result sets in resultSetsToClose results in an OutOfMemory problem.

I've changed the code in AbstractEntityPersister.processGeneratedProperties to call session.getBatcher().closeQueryStatement and the same job then runs to completion without the memory leakage.

I noticed that this method in AbstractEntityPersister has had a recent change to fix a similar problem for issue HHH-1750, so I wanted to verify that this fix is the right approach. 

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list