[hibernate-dev] Memory consumption

Hardy Ferentschik hardy at hibernate.org
Fri May 11 03:04:51 EDT 2012


On May 11, 2012, at 1:09, Scott Marlow <smarlow at redhat.com> wrote:

>> After updating JBoss 7 to use the Hibernate Validator 4.3.0 and
>> adding<property name="javax.persistence.validation.mode" value="NONE"/>
>> to our persistence.xml file I was able to reduce memory consumption
>> of SerializableValidatorFactory from ca. 90MB to ca. 256KB. :-)
> 
> It sounds like adding <property name="javax.persistence.validation.mode" 
> value="NONE"/>, is responsible for the memory savings, more than using 
> Hibernate Validator 4.3.0.  If not, it would be helpful for us to know that.

Right, in this case validation mode NONE is the determining factor. I would think you get the same result w/ Validator 4.2.0.

> Also, it might be helpful for us to see your persistence.xml.

+1

>> What I was not able to do, is to avoid loading of Hibernate Validator
>> and Hibernate Envers at all as we don't use them.

Are they loaded as part of your application or as part of the container startup?
And what exactly do you mean w/ Hibernate Validator gets loaded? Do you just see the ValidatorFactory or are there other instances from the org.hibernate.validator.

>> It's also unclear to me why Configuration, JavaReflectionManager,
>> FullTextIndexEventListener don't show up.

Not sure what you mean here.

>> I need more time to investigate the differences between the old and
>> new versions. But one thing you can change already:
>> Configuration#seconPasses should be recreated
>> when Configuration#secondPassCompile() finishes or consider using
>> LinkedList. In my case the #seconPasses has the size of 0. But the backend
>> array has the length of ca. 27000. With this change you will not save a lot of
>> memory, but I welcome every single byte I can get. :-)

We are in the process of rewriting the configuration part in Hibernate 5. Second passes will Most likely go away.

--hardy






More information about the hibernate-dev mailing list