-->
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.  [ 6 posts ] 
Author Message
 Post subject: Hibernate3.0.5 and cglib
PostPosted: Mon Oct 03, 2005 11:47 am 
Newbie

Joined: Tue Feb 03, 2004 6:18 am
Posts: 12
Hi,

First, sorry for my (bad) english

I have the next scenario:
1.- Extract DB schema with middlegen 2.1 (hibernate plugin): About 390 hbm.xml files).
2.-Gen java classes with Hbm2JavaTask (Hibernate 3.0.5 production version)
3.- Gen hibernate.cfg.xml with HibernateConfigFileTask
4.- Replace all "hibernate-mapping-2.0.dtd" with "hibernate-mapping-3.0.dtd" in all hbm.xml files and setting property default-lazy with false.

Then run a simple program test like this:
...
Configuration c = new Configuration(); //0 seconds
c.configure(); //13 seconds
SessionFactory sFactory = c.buildSessionFactory();
Session session = sFactory.openSession();
session.close();
...
During buildSessionFactory appears this exception: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
(My xms settings is -Xmx256m -Xms128m)

(I use cglib-2.1_2.jar)

Using a profiler I can see more than 1.700.000 instances of class[] in memory, I think garbage collector can't evict it. I have read in previous topics of this forum (and in cglib's forums and in others... ) but the answers doesn't help me. I changed property hibernate.cglib.use_reflection_optimizer to false and the result is the same.

What can I do?

My db is Oracle9.2i
There s no code betwen open and close session.
Exception hasn't stack trace.
No sql generated.
Debug level=warn

Thanks





Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 10:40 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Do you see 1.700.000 generated class instances with names like $$CGLIB$$ ?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 11:14 am 
Newbie

Joined: Tue Feb 03, 2004 6:18 am
Posts: 12
No, there are 1.700.000 instances of classes's Arrays (Class[])

There are only about 800 class with names like com.mypackage.Mitable$$FastClassByCGLIB$a1bd2b70


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 06, 2005 4:47 pm 
Newbie

Joined: Tue Feb 03, 2004 6:18 am
Posts: 12
sorry, there are 800 instances of my specific row classes (com.mypackage.mytable),
I supousse that the classes's array are full of classes of type $$CGLIB, but I don't know how can I discover that my profile.

If we assume the arrays al full of $$CGLIB classes how can I fix it?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 2:26 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
This stuff must be referenced by some dynamic data structure like map or list, find it (it will contain very large array or many "Entry" objects). And try to find it without any assumptions.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 07, 2005 5:44 am 
Newbie

Joined: Tue Feb 03, 2004 6:18 am
Posts: 12
You were right, better do not assumptions, sorry.

I debug throught hibernate classes and I discover that the fatidic point is in SessionFactoryImpl

// after *all* persisters and named queries are registered
Iterator iter = entityPersisters.values().iterator();
while ( iter.hasNext() ) {
( (EntityPersister) iter.next() ).postInstantiate();
}
iter = collectionPersisters.values().iterator();
while ( iter.hasNext() ) {
( (CollectionPersister) iter.next() ).postInstantiate(); <------------
}


Memory leak appearrs inside this, but I didn't found where are created the evil classes's array. Can you tell me a class where I must investigate?

Thanks baliukas and sorry for my silly questions I undestand your work is dificult with so few descriptions


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.