Alex CD (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *created* an issue
Hibernate ORM (
https://hibernate.atlassian.net/browse/HHH?atlOrigin=eyJpIjoiZTkxNWE1YTMw...
) / Improvement (
https://hibernate.atlassian.net/browse/HHH-14094?atlOrigin=eyJpIjoiZTkxNW...
) HHH-14094 (
https://hibernate.atlassian.net/browse/HHH-14094?atlOrigin=eyJpIjoiZTkxNW...
) Optimize after transaction completion cache processes memory (
https://hibernate.atlassian.net/browse/HHH-14094?atlOrigin=eyJpIjoiZTkxNW...
)
Issue Type: Improvement Affects Versions: 5.4.17 Assignee: Unassigned Created: 01/Jul/2020
13:03 PM Priority: Major Reporter: Alex CD (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
)
If caching is enabled, many actions are stored to execute cache related actions at
transaction complete.
These stored processes also keep reference to entity instances without needing them, thus
leading to a large memory footprint for long running transactions.
Even calling EntityManager.clear() has no effect on memory, because the instances are
retained by these cache operations!
The following method is used to check if an action needs to be registered for later
processing.
protected boolean needsAfterTransactionCompletion() {
return persister.canWriteToCache() || hasPostCommitEventListeners();
}
When cache is enabled, it returns true.
In case no post commit event listener is registered, the entity instance is not used in
*doAfterTransactionCompletion* methods of *EntityAction* subclasses (EntityInsertAction,
EntityDeleteAction, EntityUpdateAction).
A separation of logic would allow to keep only the *dehydrated* state for the cache
operation and clearing entity instance memory.
(
https://hibernate.atlassian.net/browse/HHH-14094#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-14094#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100131- sha1:a811519 )