openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: out of memory issues
Date Tue, 27 Jan 2009 16:31:50 GMT
Hi Adam, just some quick thoughts,

How many child objects are we talking about, and are they entities or just
objects which are persisted to the database?

If you have heap dumps it might be interesting to see which object(s) are
taking up the most memory. It sounds like the likely culprit is the number
of child objects and any OpenJPA objects associated with them.

-mike

On Mon, Jan 26, 2009 at 11:46 AM, Adam Hardy <adam.sql@cyberspaceroad.com>wrote:

> The webapp I am working on uses OpenJPA (or Hibernate depending on bugs
> blocking progress) and I have just hit a problem that currently looks like
> it will only be solved by violating the current architecture.
>
> I'm hoping I'm wrong and thought I'd ask first.
>
> The scenario is that the user can choose a whole range of financial
> instruments to put in a portfolio, and the webapp grabs them all on
> submission of the request and builds the object graph.
>
> The Manager class which is also the transactional interface then creates an
> Analysis entity to hold performance stats, and which may create for itself a
> large number of small child objects representing past performance.
>
> When the Analysis is done, the Manager call finishes and the transaction
> commits (or I commit the transaction in my unit test), and I get an
> out-of-memory exception.
>
> Presumably it's all the child object inserts causing the problem.
>
> Obviously I would like to do a flush before I run out of memory, but the
> Analysis entity object has no access to the entity manager. Or at least it
> shouldn't have.
>
> The other problem is that the Analysis entity can't really be saved until
> the child objects are all created, so I would have to think of a dirty
> work-around to allow me to save it first, to allow me to flush the child
> objects.
>
> Can anybody give some advice?
>
>
> Much appreciated
> Adam
>
>
>
>
>

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