[hibernate-dev] Memory consumption
sanne at hibernate.org
Wed May 16 06:07:23 EDT 2012
On 16 May 2012 10:47, Hardy Ferentschik <hardy at hibernate.org> wrote:
> On May 15, 2012, at 11:51 PM, Andrej Golovnin wrote:
>> 1. Consider avoiding usage of String#toLowerCase() and String#toUpperCase()
>> without specifying a Locale. Users running Hibernate on systems with Turkish as default
>> locale may see unexpected results. In Turkish there are two lowercase letters
>> \u0069 ‘i’ and \u0131 ‘ı’ (dotless ‘I’). And they are totally unrelated. Their uppercase
>> versions are \u0130 ‘İ’ (capital letter ‘I’ with dot above it) and \u0049 ‘I’.
>> So if you convert \u0049 ‘I’ to lower case and the system uses Turkish as default
>> locale, you will get \u0131 ‘ı’ (dotless ‘I’) and not 'i', e.g. 'MY_COLUMN_I' would be converted
>> to 'my_column_ı' and not 'my_column_i'. If you run Hibernate tests with Turkish as default locale
>> some tests fail. I have for now no idea, what locale should be used instead of the default
>> one. :-(
> I am not sure whether this is a problem in Hibernate as such. A lot of tests are just written without
> Locale in mind. They just makes assertions based on English. Obviously the tests could be written
> more carefully in this respect. Or do you think there is an actual bug in the runtime code caused
> by using the default Locale?
+1 on using Locale.ENGLISH in all tests.
But if this is being used in other areas it might require some more
thoughts.. hopefully avoid them altogether.
>> 2. Do not use HashMap#clone(). If the JVM is started with the option
>> -XX:+AggressiveOpts, the HashMap#clone() may produce memory leaks.
>> See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7042126.
>> IMHO the copy-constructor should be as fast as #clone().
>> Now to the memory consumption problem. The problem was introduced with the fix
>> of https://hibernate.onjira.com/browse/HHH-4546. Additional LockModes lead
>> to increased memory consumption. When I comment the changes made by
>> HHH-4546 in the method AbstractEntityPersister#createLoaders() out, I get nearly
>> the same size for SessionFactoryImpl as it was in Hibernate 3.2.7
>> (see http://goo.gl/UB47c).
> Seems you are doing really a very thorough investigation of the memory consumptions.
> Thanks for your help and feedback. We definitely will take your feedback onboard.
+1, Awesome research!
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
More information about the hibernate-dev