-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: out of memory issue with hibernate and sql server.
PostPosted: Thu Mar 29, 2012 7:27 am 
Newbie

Joined: Thu Mar 29, 2012 7:19 am
Posts: 7
Hi All,

I am facing one problem while saving data in loop in sql server 2005 database, I observed that memory which is getting acquired is not getting released(which I haven't seen for Oracle 10g database!) which results in out Of Memory exception

I tried with flushing and clearing session after specific number of saves but its still allocating memory but not freeing up.

Following is my configuration:
Code:
<prop key="hibernate.connection.pool_size">10</prop>             
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
                <prop key="hibernate.query.substitutions">
                    true 1, false 0, yes 'Y', no 'N'
                </prop>
                <prop key="hibernate.jdbc.batch_size">200</prop>
                <prop key="hibernate.c3p0.max_size">100</prop>
             <prop key="hibernate.c3p0.min_size">10</prop>
             <prop key="hibernate.c3p0.timeout">5000</prop>
             <prop key="hibernate.c3p0.max_statements">100</prop>
             <prop key="hibernate.c3p0.idle_test_period">300</prop>
             <prop key="hibernate.c3p0.acquire_increment">2</prop>
             <prop key="hibernate.c3p0.testConnectionOnCheckout">true</prop>
             <prop key="hibernate.default_schema">${database.ownername}</prop>

                <prop key="hibernate.jdbc.use_scrollable_resultsets">true</prop>
                <prop key="hibernate.jdbc.fetch_size">200</prop>
                <prop key="hibernate.cache.use_second_level_cache">false</prop>
                <prop key="hibernate.cache.use_query_cache">false</prop>
               <prop key="hibernate.connection.release_mode">after_statement</prop>
            


Top
 Profile  
 
 Post subject: Re: out of memory issue with hibernate and sql server.
PostPosted: Fri Mar 30, 2012 3:38 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Does is also happen with hibernate.jdbc.use_scrollable_resultsets set to false?
Which jdbc-driver and hibernate-version you using?
If your hibernate version provides also SQLServer2005Dialect, then try to use that instead of SQLServerDialect


Top
 Profile  
 
 Post subject: Re: out of memory issue with hibernate and sql server.
PostPosted: Fri Mar 30, 2012 3:58 am 
Newbie

Joined: Thu Mar 29, 2012 7:19 am
Posts: 7
Thanks for reply.

I tried with both options like true and false with hibernate.jdbc.use_scrollable_resultsets and seen same memory issue.

I am using sqljdbc4.jar compiled on jdk 1.4 (and tried with latest jar also.), hibernate version is 3.0

Following are hibernate version details from hibernate3.jar
Code:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.5
Created-By: 1.4.2_09-b05 (Sun Microsystems Inc.)
Hibernate-Version: 3.1.3


I tried with SQLServer2005Dialect, but its giving following error:
org.hibernate.HibernateException: Dialect class not found: org.hibernate.dialect.SQLServer2005Dialect

I will checkout supportive hibernate version for SQLServer2005Dialect and will see whether this helps me or not.


Top
 Profile  
 
 Post subject: Re: out of memory issue with hibernate and sql server.
PostPosted: Fri Mar 30, 2012 4:35 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Can you post the code of your application?

There are several ways to detect memory leaks/retention problems.
You can for example create dump-snapshots of your JVM through jconsole (requires JRE1.5 or higher) and then analyze the dumps
with JHat or the SAP-Java-MemoryAnalyzer
http://wiki.sdn.sap.com/wiki/display/Java/Java+Memory+Analysis.
By comparing 2 dump-snapshots (delta) you should be able to find out where the memory leaks/retention lies.


Top
 Profile  
 
 Post subject: Re: out of memory issue with hibernate and sql server.
PostPosted: Fri Mar 30, 2012 4:55 am 
Newbie

Joined: Thu Mar 29, 2012 7:19 am
Posts: 7
Thanks for your quick response.

In-between, I have resolved this problem by changing hibernate 3.1.3 jar to hibernate 3.6-final version.
With this jar I have seen same performance as I was working with oracle.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.