Hi Marc,

I am also working in an environment with large hierarchical structures. One
thing to be aware of is that when traversing your hierarchical structure,
the child references are not automatically released. In order to do that you
need to call evict(). Also, when creating a hierarchical structure I set
retainValues=false, so on commit all collections with child objects are
nullified as well and thus can be garbage collected.

One last note, I've encountered situations where cache was enabled and this
resulted in OutOfMemory exceptions when creating large structures with
frequent commits, even if the cache was configured to contain only a small
amount of objects (100). Disabling the cache solved it for now, but I still
need to look whether I can put this in a reproducable testcase.

kind regards,
Christiaan  


Marc Siegel wrote:
> 
> This application is retrieving sets of hierarchical data via XML-RPC
> and persisting them in a relational manner via OpenJPA.
> 
> Mac 10.4
> Java 1.5.0_07
> OpenJPA 1.0
> Property-based access
> Build-time enhancement
> 
> Entities share a common ancestor tree for shared functionality:
> EntityWithId - Id type IDENTITY
> EntityWithCreatedAt - @PrePersist sets a createdAt timestamp
> EntityWithUpdatedAt - @PreUpdate sets an updatedAt timestamp
> (currently disable due to the issue discussed on this list with
> spurious UPDATE's called on all objects in the presence of this
> annotation).
> EntityWithSynchronizedAt - isChanged (boolean) and modifiedAt (timestamp)
> 
> Does that help at all?
> 
> -Marc
> 
> On 11/5/07, Patrick Linskey <[EMAIL PROTECTED]> wrote:
>> That is surprising.
>>
>> Before we move on and consider this resolved, can you tell us more
>> about your system? Does your application put entities into any sort of
>> global or shared state? What do your configuration options look like?
>>
>> Thanks,
>>
>> -Patrick
>>
>> On Nov 5, 2007 1:08 PM, Marc Siegel <[EMAIL PROTECTED]> wrote:
>> > Hi Patrick,
>> >
>> > By creating EntityManagers and discarding (setting last reference to
>> > null), the memory usage pattern in YourKit became the expected
>> > "saw-tooth" pattern, and everything seems to work now.
>> >
>> > Thanks for your help,
>> > -Marc
>> >
>> >
>> >
>> > On 11/5/07, Marc Siegel <[EMAIL PROTECTED]> wrote:
>> > > Hi Patrick, I will post the result here after I try that.
>> > >
>> > > Thanks
>> > > -Marc
>> > >
>> > > On 11/5/07, Patrick Linskey <[EMAIL PROTECTED]> wrote:
>> > > > Do you reuse objects from one transaction in subsequent
>> transactions?
>> > > > If not, what happens if you close the EM and get a new one at the
>> end
>> > > > of every tx?
>> > > >
>> > > > -Patrick
>> > > >
>> > > > On Nov 5, 2007 10:46 AM, Marc Siegel <[EMAIL PROTECTED]>
>> wrote:
>> > > > > > > The strange thing is, I ran my application in a profiler
>> (YourKit),
>> > > > > > > and no memory is being leaked. Heap usage had just fallen to
>> 28MB
>> > > > > > > after garbage collection when the crash occurs.
>> > > > > >
>> > > > > > Hmm. That is odd.
>> > > > > >
>> > > > > > Are you running with the OpenJPA enhancer? Are you periodically
>> > > > > > flushing your transactions (or are your transactions
>> short-lived)?
>> > > > >
>> > > > > To answer your questions
>> > > > >   - Yes, I am running the opanjpa enhancer at build-time
>> > > > >   - No, I am not flushing transactions, but Yes, they are short
>> lived
>> > > > > and commit at conclusion.
>> > > > >
>> > > > > -Marc
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > > --
>> > > > Patrick Linskey
>> > > > 202 669 5907
>> > > >
>> > >
>> >
>>
>>
>>
>> --
>> Patrick Linskey
>> 202 669 5907
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/EntityManager-memory-usage-tf4752283.html#a13605264
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to