-->
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.  [ 3 posts ] 
Author Message
 Post subject: Memory Leak -com.mysql.jdbc.JDBC4ResultSet
PostPosted: Fri May 23, 2008 2:44 pm 
Newbie

Joined: Fri Jun 16, 2006 11:53 am
Posts: 12
Hibernate 3.2.6GA
Annotations 3.3.1 GA
MySQL connector 5.1.6

Problem:

I was running a lil bit o code to insert lots and lots of data into a mysql DB. A short while after starting to run this code (that does inserts well, btw), I caught a heap error. While profiling to see where the error was, I noticed that it was the JDBC4ResultSet object that was getting bigger and bigger as inserts went by. The vm crashed after a few hundred thousand inserts (would have been more with more memory, I was on 68M).

Question:

I looked at the code below and can't find a thing wrong. Is there something that could cause this error in the code below? Is there some config parameter that could cause this behavior?

This is a simplified variant of the code I really use, to try and get as simple a test case as I could. There is only one thread running this. I'm getting an intuition that it's either the mysql driver or something hibernate does wrong in using it, but then again, there could be something I don't know about. There are no exceptions thrown, for those who wonder about rollback and stuff...


Code:
for(int x = 0; x<100000; x++){
         
         Transaction tx = null;
         try {
            SessionFactory sf = sessionFactoryProvider.getSessionFactory();
            Session session = sf.openSession();
            tx = session.beginTransaction();

            for(int i = 1; i<=10; i++){

               ConstraintGroup cg = new ConstraintGroup();
               cg.setName("CG "+x+"_"+i);
               session.save(cg);
               
            }
            tx.commit();
            session.close();
         }
         catch (Exception e) {
            e.printStackTrace();
         }
      }


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 23, 2008 2:57 pm 
Newbie

Joined: Fri Jun 16, 2006 11:53 am
Posts: 12
More info:

using mysql connector 5.0.8 driver does not cause this memory leak.


Top
 Profile  
 
 Post subject: Re: Memory Leak -com.mysql.jdbc.JDBC4ResultSet
PostPosted: Tue Nov 17, 2009 7:23 am 
Newbie

Joined: Tue Nov 17, 2009 7:12 am
Posts: 1
I know this post is more than a year old, but wanted to comment that I have observed the same problem using

  • MySQL Connector/J 5.1.6
  • MySQL 5.0.45
  • hibernate-annotations-3.4.0.GA
  • hibernate-c3p0-3.3.2.GA
  • hibernate-core-3.3.2.GA

Makes me wonder whether

    a) the problem persists when you are actually using MySQL 5.1 instead of MySQL 5.0
    b) the people of MySQL know of this issue (there does not seem to be an entry on their bug database)

-hendrik


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