-->
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.  [ 4 posts ] 
Author Message
 Post subject: Out of Memory Error occuring frequently
PostPosted: Thu Aug 04, 2005 2:59 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 2:21 am
Posts: 22
hi

i ported my existing application to hibernate sucessfully . but i'm getting out of memory error frequently . i turned on second level caching as well as query caching . i'm using ehcache provider with cache-usage ="read-only" . i also enable setcacheable(true) for my queries .
but still my performance is horrible .

whats the difference b/w making a query cacheable and turning on Second level caching ?.
whether turning on cache-usage on Collecion (Set) will improve my performance .?

what else i'm missing here .

kindly help me in this .

thanks
Balaji


Top
 Profile  
 
 Post subject: Re: Out of Memory Error occuring frequently
PostPosted: Thu Aug 04, 2005 3:08 pm 
Beginner
Beginner

Joined: Tue Jul 12, 2005 10:27 am
Posts: 23
balaji wrote:
hi

i ported my existing application to hibernate sucessfully . but i'm getting out of memory error frequently . i turned on second level caching as well as query caching . i'm using ehcache provider with cache-usage ="read-only" . i also enable setcacheable(true) for my queries .
but still my performance is horrible .

whats the difference b/w making a query cacheable and turning on Second level caching ?.
whether turning on cache-usage on Collecion (Set) will improve my performance .?

what else i'm missing here .

kindly help me in this .

thanks
Balaji


Are you running long transactions? If so, that'll cause Hibernate to continue to suck up memory. Look into session.evict() or session.clear()

query cache -Query result sets may also be cached. This is only useful for queries that are run frequently with the same parameters.

Where second level cache isn't based on a query.

_________________
- Richard Burton


Top
 Profile  
 
 Post subject: Re: Out of Memory Error occuring frequently
PostPosted: Thu Jan 07, 2010 1:50 am 
Newbie

Joined: Thu Jan 07, 2010 1:42 am
Posts: 2
Hi,

I am trying to insert 1000 records but it runs out of memory. Could you please tell us the possible reason for this?

here is my code snippet,

session = createdHibernateSessionFactory();
for(int i=0;i<1000;i++)
{
Contact con = new Contact();
con.setEmail("ssstudhaya@cashedhe.com");
con.setFirstname("Vijay");
con.setLastname("Kumar");
createContact(con);
}

Thanks,
Udhaya


Top
 Profile  
 
 Post subject: Re: Out of Memory Error occuring frequently
PostPosted: Thu Jan 07, 2010 2:07 am 
Beginner
Beginner

Joined: Tue Jul 12, 2005 10:27 am
Posts: 23
Your OutOfMemoryException (OOME) might be occurring because your Session object will contain a cache version of the class.

One resolution is to commit after X number of transactions and clear the session. Do some test to determine what the best value of X is for the case you're working on.

Notes: Avoid using Hibernate when doing batch related work. There's a few reasons for this bit of advice, one is because of the issue you're incurring with the Session level caching.

For more information about Hibernates caching, please read the caching section of the reference guide.

Regards,
Richard L. Burton III
http://SmartCodeLLC.com

_________________
- Richard Burton


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.