[email protected]
[Top] [All Lists]

Re: getIteratorByQuery + thousands of objects = OutOfMemoryError

Subject: Re: getIteratorByQuery + thousands of objects = OutOfMemoryError
From: "Vasily Ivanov"
Date: Fri, 16 Nov 2007 19:26:42 +1100
We are using Ojb 1.0.4.

On 16/11/2007, Vasily Ivanov <[email protected]> wrote:
> Hello,
> We've got a system that needs to update thousands (possibly hundreds
> of thousands) of Objects.
> After reading OJB FAQ I thought that
> PersistenceBroker.getIteratorByQuery(query) would be the best solution
> in this case. Query runs fine and returns RsIterator. However the
> problems start when I try to iterate and process few thousands of
> records eventually I get OutOfMemoryError (out of java heap). I did
> profiling and found that QueryReferenceBroker object holds a big
> ArrayList called prefetchingListeners that grows rapidly while
> iterating. I think that's because OJB keeps all objects to commit when
> PersistenceBroker is closed.
> What I do is I call the following statement after each iteration:
> ((PersistenceBrokerInternal)
> pb).getReferenceBroker().removePrefetchingListeners();
> That helped but that's obviously not the best way of doing it and I
> don't know how thread-safe it is.
> Is there any more appropriate way of doing that?
> Thank you,
> Vasily

To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

<Prev in Thread] Current Thread [Next in Thread>