openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Curtis <curti...@gmail.com>
Subject Re: Memory Issues
Date Tue, 25 Aug 2009 15:16:39 GMT
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 <kevin.lohmann@d-velop.de>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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message