Re: {Filename?} Memory Leak?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Oct 28 2004 - 20:34:35 EDT

  • Next message: Derek Rendall: "Re: Prefetching and paginated queries"

    > I'd recommend creating a new context between batches.
    > Otherwise you'll at minimum end up with Fault representations of each
    > object
    > if not the full object.

    I think this is the essence of the problem. Here is a simplified
    diagram of Cayenne access stack:

    http://objectstyle.org/cayenne/userguide/design/access.html

    While shared cache at the DataDomain level (see the diagram) has an
    upper limit on the number of entries settable in the modeler,
    DataContext-level cache (aka ObjectStore) doesn't have one, as
    DataContexts are user-managed. So it will grow indefinitely, even
    though you commit your batches... So create a new instance of
    DataContext in the end of the "flush" method (and also make sure you
    don't have any reused DataObject ivars that point to the old
    DataContext, or transfer them to the new one using
    DataContext.localObjects(..)).

    Andrus

    On Oct 28, 2004, at 4:06 PM, Mike Kienenberger wrote:
    > Justin Deutsch <justin.deutsc..elevance.com.au> wrote:
    >> At the moment I seem to have run into a problem where I run out of
    >> memory when I'm trying to insert the log files into the database (the
    >> files total over 300MB of data). The database, currently has three
    > tables:
    >>
    >> Message - the log message.
    >> Log_Level - the level of the message, e.g. warn, info.
    >> Host - The host the message was logged on.
    >>
    >> At the moment I seem to be able to insert about 44000 entries before I
    >> run out of memory (Heap size: 64MB). Now I believe that I'm getting
    >> rid
    >> of all of the instances of Message, LogLevel and Host (the java
    >> objects) that I am creating, but I'm not sure, and I was hoping
    >> someone
    >> could help me out.
    >
    > Are you sure you're clearing the data out of the cayenne layer?
    >
    > I'd recommend creating a new context between batches.
    > Otherwise you'll at minimum end up with Fault representations of each
    > object
    > if not the full object.
    >
    > A good memory profiling tool should be able to show you exactly what's
    > using
    > up all of your memory.
    >
    > At one point, I'd have recommended Optimize-It, but it's been serveral
    > years
    > since I've used it.
    >
    > -Mike
    >



    This archive was generated by hypermail 2.0.0 : Thu Oct 28 2004 - 20:34:40 EDT