[hibernate-issues] [Hibernate-JIRA] Created: (HHH-5805) Allow unmodified objects in session to be garbage collected using weak references

Archie Cobbs (JIRA) noreply at atlassian.com
Tue Dec 21 17:59:05 EST 2010


Allow unmodified objects in session to be garbage collected using weak references
---------------------------------------------------------------------------------

                 Key: HHH-5805
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5805
             Project: Hibernate Core
          Issue Type: New Feature
          Components: core
    Affects Versions: 3.6.0
            Reporter: Archie Cobbs


Suggestion for a new feature.

Add a new setting that would configure Hibernate to only weakly reference unmodified objects in the session. Once an object in the session is modified, it would of course need to be strongly referenced. However, after that object's modifications had been persisted (e.g., via a {{flush()}} operation), that object could revert to being weakly referenced again.

This would allow unmodified objects that are no longer referenced by the application to be garbage collected. This would in turn allow an unbounded number of such objects to flow through the persistence context over time, enabling operations that load an arbitrarily large set of objects into one session. Currently this is not possible due to the eventual {{OutOfMemoryError}} you will get if you do this.

The current workaround is to use {{evict()}}, but this is inconvenient and tedious to get right (that is, it's hard to know if you've truly evicted everything or if you've only made the memory leak smaller), especially as the graph of objects loaded into the session gets more complicated. This feature would provide an easy and robust way to eliminate the {{OutOfMemoryError}} problem.


-- 
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