Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 13744 invoked from network); 25 Aug 2009 15:16:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 25 Aug 2009 15:16:45 -0000 Received: (qmail 73373 invoked by uid 500); 25 Aug 2009 15:17:10 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 73342 invoked by uid 500); 25 Aug 2009 15:17:10 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 73332 invoked by uid 99); 25 Aug 2009 15:17:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Aug 2009 15:17:10 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of curtisr7@gmail.com designates 209.85.217.216 as permitted sender) Received: from [209.85.217.216] (HELO mail-gx0-f216.google.com) (209.85.217.216) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Aug 2009 15:17:00 +0000 Received: by gxk12 with SMTP id 12so4378600gxk.4 for ; Tue, 25 Aug 2009 08:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=ZsQl+xQxbJ8KozoZC2BNE4Sk/fvU1ajzbwOX6Xxb1c4=; b=xhZQ+y/t2D+JftSGKJOKHGQ2SF3BqAnhuj5j5+cnQNbl7lYJBeHjUjImnwgppyBl8J z6X8aqBPKpsT0uRl/8Yy6kDsx7+CASuhSkgccmZSXUGahdLUBEMAMEwAvXlwDKwds2Zy eR+w1m4qC6RSTUBZugrJuWAmAepdEuDSvKgfs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=AYmIGvaNgFv7taDz4pn6tsxFXVZym/qFshseiQLIOF0ldBCOXUbP8kfTkgsLjSweag J4giggKBzv77Czs9zezp+oxQF0VVZdeqzk/8eyLWKgzKRoJEiQ1QXrQCpe/WvzYwyNkO oYKabHiBk+jxbqEkJeff7TiuoMQyNLalpYShE= MIME-Version: 1.0 Received: by 10.150.107.2 with SMTP id f2mr9454705ybc.188.1251213399318; Tue, 25 Aug 2009 08:16:39 -0700 (PDT) In-Reply-To: References: Date: Tue, 25 Aug 2009 10:16:39 -0500 Message-ID: Subject: Re: Memory Issues From: Rick Curtis To: users@openjpa.apache.org Content-Type: multipart/alternative; boundary=000e0cd5f6663461120471f8d215 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd5f6663461120471f8d215 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Kevin - I'm willing to bet that the problem you're running into is a result of not enhancing your Entities. Take a read through the 'Entity Enhancement' page [1] and let us know how it goes. Thanks, Rick [1] http://openjpa.apache.org/entity-enhancement.html On Tue, Aug 25, 2009 at 9:24 AM, Lohmann Kevin wrote: > Hi *, > > I'm using openjpa 1.2.1 and Derby 10.4.2.0 and I'm getting > OutOfMemoryErrors (Java heap space). > > I have a class named 'Data' which has a byte-array. The class is > annotated. > > In a small test I create one EntityManagerFactory and - in a loop - 100 > EntiyManagers. > > For each EM I start a transaction, create a Data-Object, fill it with > the byte-array, persist the object, commit the transaction and close the > EM. > > Surprisingly the OutOfMemoryError occurs after the ~70. loop-event. With > JProfiler I see, that all Data-Objects are still in the memory, but I > don't use any cache (DataCache + QueryCache). The objects are held by > 'org.apache.openjpa.enhance.ReflectingPersistenceCapable' and > 'org.apache.openjpa.lib.util.concurrent.ConcurrentReferenceHashMap'. > > Is it because I use RuntimeEnhancement? > > I guess, I miss some configuration!? With Hibernate or EclipseLink these > OOME doesn't occure (the objects are then gc'ed - just like expected!). > > Can anyone point me to the missing config parameter? Or is it a known > bug, which I can find in the inet? > > The config-parameter I use: > > props.put("openjpa.ConnectionURL", > "jdbc:derby:C:\\database";create=true"); > props.put("openjpa.ConnectionDriverName", > "org.apache.derby.jdbc.EmbeddedDriver"); > > props.put("openjpa.jdbc.SynchronizeMappings", "buildSchema"); > props.put("openjpa.RuntimeUnenhancedClasses", "supported"); > props.put("openjpa.MetaDataFactory", > "jpa(Types=\"use.database.Data\")"); > > props.put("openjpa.Multithreaded", "true"); > > props.put("openjpa.Log", "log4j"); > props.put("openjpa.ConnectionFactoryProperties", > "PrettyPrint=true, PrettyPrintLineLength=22"); > > props.put("openjpa.DataCache", "false"); > props.put("openjpa.QueryCache", "false"); > > My Code: > > EntityManagerFactory lEMF = Persistence > .createEntityManagerFactory("openjpa", > props); > > for (int i = 0; i < 100; i++) { > > EntityManager lEM = lEMF.createEntityManager(); > > lEM.getTransaction().begin(); > > Data lData = new Data(); > // Here a file is read out, that has a size of 800kb > lData.setContent(getContentFromFile()); > > lEM.persist(lData); > lEM.getTransaction().commit(); > > lEM.close(); > > } > > Cheers, > Kevin > --000e0cd5f6663461120471f8d215--