[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-5549) Add option for use of weak references in the session cache

Steve Ebersole (JIRA) noreply at atlassian.com
Thu Sep 9 15:24:18 EDT 2010


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5549?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole closed HHH-5549.
-------------------------------

    Resolution: Rejected

Its more than just a "cache", in fact its not even called a cache, its called a persistence context as in a {{org.hibernate.engine.PersistenceContext}}.

> Add option for use of weak references in the session cache
> ----------------------------------------------------------
>
>                 Key: HHH-5549
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5549
>             Project: Hibernate Core
>          Issue Type: New Feature
>          Components: core
>    Affects Versions: 3.3.2
>            Reporter: Archie Cobbs
>   Original Estimate: 4h
>  Remaining Estimate: 4h
>
> Hibernate's session cache requires manual action (i.e., evict() and/or clear()) to prevent it from growing without bound when iterating over a large set of entities. This was surprising to me the first time I encountered it, because most people's concept of a "cache" includes the idea of transparency, i.e., the cache is not apparent except in increased performance. Hibernate's cache, even within a read-only transaction, effectively has a built-in memory leak.
> But anyway, this problem can be fixed easily. Suggest adding a new feature which would (optionally) allow the session cache to be configured to automatically evict unmodified objects that were no longer referenced.
> The session cache would change to use two kinds of references to objects in the cache: normal strong references for objects that are new or modified in any way, and weak references for objects that have not been modified. Hibernate would have to switch a weakly referenced object into a strongly referenced one once it was modified.
> This way, unmodified, weakly referenced objects would automatically fall out of the cache when they were no longer referenced by the application, and the "iterate over a large dataset" memory leak would be fixed.

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