Re: ResultIterator and OutOfMemory

From: Jürgen Saar (jsaa..eb.de)
Date: Fri Aug 26 2005 - 03:28:57 EDT

  • Next message: Sean Tan: "PersistenceState relation to property changes"

    Replacing the 'working' DataContext after 250 commits seems
    to solve the problem, but it seems to be neccessary
    to do an explizit System.gc() after replacing the context
    ... strange ...

    cayenne-use..bjectstyle.org schrieb am 19.08.05 15:32:16:
    >
    > First thing of course is to check that enough memory is available to
    > the JVM. Increase it using -Xmx command line switch, and this maybe
    > the end of it. If this doesn't help, try other things below.
    >
    >
    > > For checking the order I have definded a second DataContext
    > > that does some inserts into a separate table.
    > > This context allways gets a commit/rollback after
    > > having processed one order ...
    >
    > That might be a problem if a second DataContext accumulates too many
    > objects. THEY ARE NOT REMOVED FROM CACHE ON COMMIT. I'd suggest to
    > get rid of a second DataContext after every X number of commits and
    > replace it with a new instance. Or use
    > ObjectStore.startTrackingNewObjects()/unregisterNewObjects() API to
    > manually clean a DataContext without disposing it.
    >
    > > Any hint, how to find the memory eating instance without the help
    > > of a profiler?
    >
    >
    > You can get a rough estimate of the number of objects registered with
    > each DataContext.
    >
    > In Cayenne 1.1 you would do this:
    >
    > // comment out this code in production as "getObjects" clones objects
    > array on every call
    > context.getObjectStore().getObjects().size();
    >
    > In Cayenne 1.2 there is a more efficient way:
    >
    > context.getObjectStore().registeredObjectsCount();
    >
    > Andrus
    >
    >
    >
    > On Aug 19, 2005, at 5:16 PM, jsaa..eb.de wrote:
    >
    > >
    > > Hi,
    > >
    > > I'v got a problem with the ResultIterator.
    > > For my understanding, this is the way to iterate thru
    > > large amount of datarows.
    > >
    > > I have to analyze all orders in database
    > > So I took the example from:
    > > http://www.objectstyle.org/cayenne/userguide/perform/result-
    > > iterator.html
    > > and did it this way ...
    > >
    > > But after about 46000 rows an OutOfMemoryException ist raised
    > >
    > > For checking the order I have definded a second DataContext
    > > that does some inserts into a separate table.
    > > This context allways gets a commit/rollback after
    > > having processed one order ...
    > >
    > > Any hint, how to find the memory eating instance without the help
    > > of a profiler?
    > >
    > > Thanx
    > > --- Juergen ---

    _________________________________________________________________________
    Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle
    Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179



    This archive was generated by hypermail 2.0.0 : Fri Aug 26 2005 - 03:29:06 EDT