« Return to Thread: Memory leak

Re: Memory leak

by Erick Erickson :: Rate this Message:

Reply to Author | View in Thread

When you say "the whole operation running in a transaction" are you
talking about a transaction around the whole database load or around
an iteration of adding a bunch of records, doing a flush and clear?

Because I can imagine that Hibernate is holding a bunch of memory for
everything done in a transaction and if you're loading millions of instances
in a transaction....

Best
Erick@AShotInTheDark....

On Thu, Sep 4, 2008 at 10:53 AM, Burt Beckwith <burt@...> wrote:
I'm building a large database for load testing, so I'm creating millions of
domain instances. I'm trying to use the standard bulk insert approach in
Hibernate, i.e. flush() and clear() the session periodically, with the whole
operation running in a transaction.

The problem is the instances are still around - I run out of memory after a
few hours with a heap set at 1G. I've turned off 2nd-level caching and looked
at the Session in a debugger and clear() definitely works - it's empty
afterwards. There are no mapped collections, and I'm not keeping any explicit
references to the instances.

But running in a profiler I can see the instance count steadily increase and
never decrease. Running gc() has no effect.

Any thoughts on what might be keeping a reference to these instances?

Burt

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



 « Return to Thread: Memory leak