Use intern() to reuse strings and reduce memory usage / save 6%
----------------------------------------------------------------
Key: HHH-5232
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5232
Project: Hibernate Core
Issue Type: Patch
Components: core
Affects Versions: 3.6
Environment: Hibernate 3.6.0-SNAPSHOT
Linux x86_64 Bits
Reporter: Yves Galante
Priority: Minor
Attachments: DuplicateString.patch
This patch is an update of JIRRA HHH-3924 for Hibernate 3.6.
Testsuite executed without new failures.
Resume of the original JIRRA HHH-3924 :
>DefaultEntityAliases suffix and rowIdAliases String fields are not
interned as are other fields in the class. This leads to significant >>of memory
usage on our application.
>BasicLoader suffixes and QueryLoader sqlAliasSuffixes can also be interned so as to
save more memory
See the detailed result of this patch :
========================================
Test conditions
========================================
Hibernate version : 3.6.0-SNAPSHOT
Yourkit : 8.0
OS : Linux x86_64 Bits.
Test case : org.hibernate.test.legacy.ParentChildTest.testReplicate()
Time : Memory snapshot is taken at the of the test.
========================================
Result before patch
========================================
SessionFactoryImpl size : 3939 KB
Duplicates String example :
"0_" : 452 duplicates (32KB)
"rowid_0_" : 405 duplicates (32KB)
"1_" : 145 duplicates (10KB)
"rowid_1_" : 130 duplicates (10KB)
...
"fee3_" : 65 duplicates (5KB)
"glarch1_" : 55 duplicates (5KB)
...
"foo2_2_5" : 46 duplicates (3KB)
...
"string" : 28 duplicates (2KB)
========================================
Result after patch
========================================
SessionFactoryImpl size : 3688 KB
Save 251 Kb, 6% of the session factory size.
--
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