I have set up a very basic Bean, that just selects some stuff from a small table. It is running on a Tomncat 5. Although I have disabled query-caching the application consumes more and more memory with each request. Even if I do garbage colelction by intention the memory is not freed. Does anyone know about such an behavior? At the moment (and alter of course ;) I would very, very much appreciate any comment on this.
Thanks alot and regards, Hans
Hibernate version: 2.1
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping package="com.vote">
<class name="com.vote.User" table="tuser">
<id
column="iduser"
name="iduser"
type="int"
>
<generator class="increment"/>
</id>
<property
column="firstname"
length="255"
name="firstname"
not-null="false"
type="string"
/>
.....
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
String query = "select user from user in class com.vote.User WHERE confirmed='y' order by creationdate asc";
sess.createQuery(query);
List list = sess.find(query);
Name and version of the database you are using:
Mysql 4.0.18
Debug level Hibernate log excerpt:
18:44:48 INFO Environment:462 - Hibernate 2.1.4
18:44:48 INFO Environment:496 - loaded properties from resource hibernate.properties: {hibernate.cglib.use_reflection_optimizer=true, hibernate.cache.provider_class=net.sf.ehcache.hibernate.Provider, hibernate.cache.use_query_cache=false, hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, hibernate.max_fetch_depth=1, hibernate.jdbc.use_streams_for_binary=true, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', hibernate.jdbc.batch_size=0, hibernate.cache.region_prefix=hibernate.test, hibernate.connection.datasource=java:comp/env/jdbc/mysql, hibernate.show_sql=true}
18:44:48 INFO Environment:521 - using java.io streams to persist binary types
18:44:48 INFO Environment:522 - using CGLIB reflection optimizer
18:44:48 INFO Configuration:347 - Mapping resource: com/vote/User.hbm.xml
18:44:48 DEBUG DTDEntityResolver:20 - trying to locate
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath under net/sf/hibernate/
18:44:48 DEBUG DTDEntityResolver:29 - found
http://hibernate.sourceforge.net/hibern ... ng-2.0.dtd in classpath
18:44:49 INFO Binder:229 - Mapping class: com.vote.User -> tuser
18:44:49 DEBUG Binder:475 - Mapped property: iduser -> iduser, type: integer
18:44:49 DEBUG Binder:475 - Mapped property: firstname -> firstname, type: string
[...]
18:44:49 INFO Configuration:613 - processing one-to-many association mappings
18:44:49 INFO Configuration:622 - processing one-to-one association property references
18:44:49 INFO Configuration:647 - processing foreign key constraints
18:44:49 INFO Dialect:82 - Using dialect: net.sf.hibernate.dialect.MySQLDialect
18:44:49 INFO SettingsFactory:58 - Maximim outer join fetch depth: 1
18:44:49 INFO SettingsFactory:62 - Use outer join fetching: false
18:44:49 INFO NamingHelper:26 - JNDI InitialContext properties:{}
18:44:49 INFO DatasourceConnectionProvider:51 - Using datasource: java:comp/env/jdbc/mysql
18:44:49 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of process level read-write cache is not recommended)
18:44:49 INFO SettingsFactory:102 - Use scrollable result sets: true
18:44:49 INFO SettingsFactory:105 - Use JDBC3 getGeneratedKeys(): true
18:44:49 INFO SettingsFactory:108 - Optimize cache for minimal puts: false
18:44:49 INFO SettingsFactory:114 - echoing all SQL to stdout
18:44:49 INFO SettingsFactory:117 - Query language substitutions: {no='N', true=1, yes='Y', false=0}
18:44:49 INFO SettingsFactory:128 - cache provider: net.sf.ehcache.hibernate.Provider
18:44:49 INFO Configuration:1093 - instantiating and configuring caches
18:44:49 INFO SessionFactoryImpl:119 - building session factory
18:44:49 DEBUG SessionFactoryImpl:125 - instantiating session factory with properties: {java.vendor=Sun Microsystems Inc., catalina.base=C:\jakarta-tomcat-5.0.18, catalina.useNaming=true, os.name=Windows XP, sun.boot.class.path=C:\jakarta-tomcat-5.0.18/common/endorsed\xercesImpl.jar;C:\jakarta-tomcat-5.0.18/common/endorsed\xmlParserAPIs.jar;C:\JBuilderX\jdk1.4\jre\lib\rt.jar;C:\JBuilderX\jdk1.4\jre\lib\i18n.jar;C:\JBuilderX\jdk1.4\jre\lib\sunrsasign.jar;C:\JBuilderX\jdk1.4\jre\lib\jsse.jar;C:\JBuilderX\jdk1.4\jre\lib\jce.jar;C:\JBuilderX\jdk1.4\jre\lib\charsets.jar;C:\JBuilderX\jdk1.4\jre\classes, sun.java2d.fontpath=, java.vm.specification.vendor=Sun Microsystems Inc., java.runtime.version=1.4.2_01-b06, hibernate.cache.provider_class=net.sf.ehcache.hibernate.Provider, user.name=hschneid, shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar, user.language=de, java.naming.factory.initial=org.apache.naming.java.javaURLContextFactory, sun.boot.library.path=C:\JBuilderX\jdk1.4\jre\bin, sun.io.useCanonCaches=false, java.version=1.4.2_01, version=2.4.1, user.timezone=Europe/Berlin, sun.arch.data.model=32, java.endorsed.dirs=C:\jakarta-tomcat-5.0.18/common/endorsed, sun.cpu.isalist=pentium i486 i386, file.encoding.pkg=sun.io, package.access=sun.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper.,sun.beans., file.separator=\, java.specification.name=Java Platform API Specification, hibernate.cglib.use_reflection_optimizer=true, java.class.version=48.0, user.country=DE, java.home=C:\JBuilderX\jdk1.4\jre, java.vm.info=mixed mode, os.version=5.1, hibernate.connection.datasource=java:comp/env/jdbc/mysql, path.separator=;, java.vm.version=1.4.2_01-b06, hibernate.max_fetch_depth=1, java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory, user.variant=, vendor-url=http://xml.apache.org/xalan-j, hibernate.jdbc.batch_size=0, java.awt.printerjob=sun.awt.windows.WPrinterJob, vendor=Apache Software Foundation, sun.io.unicode.encoding=UnicodeLittle, awt.toolkit=sun.awt.windows.WToolkit, package.definition=sun.,java.,org.apache.catalina.,org.apache.coyote.,org.apache.tomcat.,org.apache.jasper., hibernate.cache.region_prefix=hibernate.test, java.naming.factory.url.pkgs=org.apache.naming, user.home=C:\Dokumente und Einstellungen\HSCHNEID, hibernate.query.substitutions=true 1, false 0, yes 'Y', no 'N', java.specification.vendor=Sun Microsystems Inc., org.xml.sax.driver=org.apache.crimson.parser.XMLReaderImpl, java.library.path=C:\JBuilderX\jdk1.4\bin;C:\jakarta-tomcat-5.0.18\bin, java.vendor.url=http://java.sun.com/, java.vm.vendor=Sun Microsystems Inc., hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect, common.loader=${catalina.home}/common/classes,${catalina.home}/common/endorsed/*.jar,${catalina.home}/common/lib/*.jar, hibernate.jdbc.use_streams_for_binary=true, java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition, java.class.path=C:\jakarta-tomcat-5.0.18/bin/bootstrap.jar;C:\JBuilderX\jdk1.4/lib/tools.jar, java.vm.specification.name=Java Virtual Machine Specification, java.vm.specification.version=1.0, catalina.home=C:\jakarta-tomcat-5.0.18, sun.cpu.endian=little, sun.os.patch.level=Service Pack 1, hibernate.cache.use_query_cache=false, java.io.tmpdir=C:\jakarta-tomcat-5.0.18\temp, java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi, server.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar, os.arch=x86, java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment, java.ext.dirs=C:\JBuilderX\jdk1.4\jre\lib\ext, user.dir=C:\jakarta-tomcat-5.0.18\bin, line.separator=
, java.vm.name=Java HotSpot(TM) Client VM, file.encoding=Cp1252, java.specification.version=1.4, hibernate.show_sql=true}
18:44:50 DEBUG SessionFactoryObjectFactory:39 - initializing class SessionFactoryObjectFactory
18:44:50 DEBUG SessionFactoryObjectFactory:76 - registered: 2c962229fe96d5d600fe96d5d9850000 (unnamed)
18:44:50 INFO SessionFactoryObjectFactory:82 - no JNDI name configured
18:44:50 DEBUG SessionFactoryImpl:196 - instantiated session factory
18:44:50 DEBUG SessionImpl:555 - opened session
18:44:50 DEBUG SessionImpl:1526 - find: select user from user in class com.vote.User WHERE confirmed='y' order by creationdate asc
18:44:50 DEBUG QueryTranslator:147 - compiling query
18:44:50 DEBUG SessionImpl:2242 - flushing session
18:44:50 DEBUG SessionImpl:2435 - Flushing entities and processing referenced collections
18:44:50 DEBUG SessionImpl:2776 - Processing unreferenced collections
18:44:50 DEBUG SessionImpl:2790 - Scheduling collection removes/(re)creates/updates
18:44:50 DEBUG SessionImpl:2266 - Flushed: 0 insertions, 0 updates, 0 deletions to 0 objects
18:44:50 DEBUG SessionImpl:2271 - Flushed: 0 (re)creations, 0 updates, 0 removals to 0 collections
18:44:50 DEBUG SessionImpl:1814 - Dont need to execute flush
18:44:50 DEBUG QueryTranslator:199 - HQL: select user from user in class com.vote.User WHERE confirmed='y' order by creationdate asc
18:44:50 DEBUG QueryTranslator:200 - SQL: select user.iduser as iduser, user.firstname as firstname, user.lastname as lastname, user.street as street, user.number as number, user.postalcode as postalcode, user.city as city, user.phone as phone, user.age as age, user.username as username, user.passphrase as passphrase, user.email as email, user.creationdate as creatio13_, user.lastlogindate as lastlog14_, user.confirmed as confirmed, user.imageconfirmed as imageco16_, user.confirmcode as confirm17_, user.size as size, user.image as image, user.fkidfiliale as fkidfil20_ from tuser user where (confirmed='y' ) order by creationdate asc
18:44:50 DEBUG BatcherImpl:196 - about to open: 0 open PreparedStatements, 0 open ResultSets
18:44:50 DEBUG SQL:237 - select user.iduser as iduser, user.firstname as firstname, user.lastname as lastname, user.street as street, user.number as number, user.postalcode as postalcode, user.city as city, user.phone as phone, user.age as age, user.username as username, user.passphrase as passphrase, user.email as email, user.creationdate as creatio13_, user.lastlogindate as lastlog14_, user.confirmed as confirmed, user.imageconfirmed as imageco16_, user.confirmcode as confirm17_, user.size as size, user.image as image, user.fkidfiliale as fkidfil20_ from tuser user where (confirmed='y' ) order by creationdate asc
Hibernate: select user.iduser as iduser, user.firstname as firstname, user.lastname as lastname, user.street as street, user.number as number, user.postalcode as postalcode, user.city as city, user.phone as phone, user.age as age, user.username as username, user.passphrase as passphrase, user.email as email, user.creationdate as creatio13_, user.lastlogindate as lastlog14_, user.confirmed as confirmed, user.imageconfirmed as imageco16_, user.confirmcode as confirm17_, user.size as size, user.image as image, user.fkidfiliale as fkidfil20_ from tuser user where (confirmed='y' ) order by creationdate asc
18:44:50 DEBUG BatcherImpl:241 - preparing statement
18:44:50 DEBUG Loader:197 - processing result set
18:44:50 DEBUG Loader:405 - result row: 9114
18:44:50 DEBUG Loader:536 - Initializing object from ResultSet: 9114
18:44:50 DEBUG Loader:605 - Hydrating entity: com.vote.User#9114
[.....]
18:44:50 DEBUG Loader:226 - done processing result set (22 rows)
18:44:50 DEBUG BatcherImpl:203 - done closing: 0 open PreparedStatements, 0 open ResultSets
18:44:50 DEBUG BatcherImpl:261 - closing statement
18:44:50 DEBUG Loader:239 - total objects hydrated: 22
18:44:50 DEBUG SessionImpl:2198 - resolving associations for [com.vote.User#9114]
18:44:50 DEBUG SessionImpl:2222 - done materializing entity [com.vote.User#9114]
[....]
18:44:50 DEBUG SessionImpl:3112 - initializing non-lazy collections
18:44:50 DEBUG SessionImpl:573 - closing session
18:44:50 DEBUG SessionImpl:3332 - disconnecting session
18:44:50 DEBUG SessionImpl:585 - transaction completion