[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3195?page=c...
]
Chris Brown commented on HHH-3195:
----------------------------------
Sadly, calling executeActions does not cause the references to be released - if you put a
breakpoint in executeActions, you'll see that it is called on a regular flush anyway.
I have had success getting Hibernate to release the references by calling this after
session.clear():
((SessionImpl)session).getActionQueue().afterTransactionCompletion(true)
If you are only doing inserts I think this should be a fairly safe solution, because the
afterTransactionCompletion hook for an insert just updates the 2nd level cache, which you
should have disabled anyway.
The problem is due to the fact that the ActionQueue finds out whether the cache is enabled
by calling:
session.getFactory().getSettings().isQueryCacheEnabled()
It seems to me that this check should also take into account whether the second-level
cache is enabled, and the current cache mode of the session.
session.clear() is not effective when use_query_cache is true
-------------------------------------------------------------
Key: HHH-3195
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3195
Project: Hibernate Core
Issue Type: Bug
Affects Versions: 3.2.6
Environment: 3.2.6.ga, MySQL5
Reporter: James Berry
As discussed in detail in
http://forum.hibernate.org/viewtopic.php?t=944918, performing
many inserts while use_query_cache is enabled will eventually cause an out of memory
condition, even if the session is periodically flushed and cleared. That forum thread
describes a potential root cause for this problem. Nobody from the Hibernate team has
responded regarding the forum thread, even though it's been alive for three years
now!
Note that an answer to "disable the query cache" is not a good solution to the
problem, as we need the query cache elsewhere. If it were possible to disable the query
cache for a particular session, that would be fine, but I see no way do that.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira