Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to limit Java String creation in Hibernate?

We are trying to improve performance in our Java application. While using the Memory Analysis tool, I noticed that there are many duplicate Strings that seem to have originated in Hibernate. For example, the Memory Analysis Tool sees over 6000 occurrences of "rowid_0_" and "0_", and tracing to the GC root shows Hibernate's involvement:

enter image description here

It seems as though we could improve performance if we could intern those Strings. If it were "our" code, I could modify it and see the effects. Is there any way that I can coerce Hibernate into using interned Strings?

like image 350
kc2001 Avatar asked Feb 25 '14 16:02

kc2001


1 Answers

I now see that the Hibernate issue 3924 refers to this. However, HHH-3924 has a status of "Open", and is unresolved. It does refer to a code patch that interns the rowid Strings.

like image 185
kc2001 Avatar answered Sep 22 '22 06:09

kc2001