Re: cayenne memory behaviour

From: Arndt Brenschede (a..iamos.de)
Date: Sat Mar 08 2003 - 07:51:38 EST

  • Next message: Nanik Tolaram: "Struts problem"

    Hi Martin,

    you may have a look at the thread
    "high-volume-offline-processing", especially at:

    http://objectstyle.org/cayenne/lists/cayenne-user/2003/03/0000.html

    I was working on a similar problem, and came up with a solution
    to make the ObjectStore track the Object-Registration and
    have 2 additional methods:

    - ObjectStore.startTrackingNewObjects();
    - ObjectStore.unregisterNewObjects();

    (you can find the patched ObjectStore in
    the attachment of above message)

    They can be used to keep the memory clean.
    (I tried a very similar example, that, in addition,
    also modifies and creates objects. I used a batch
    unit of 100, and after each batch called commitChanges()
    and then the above 2 methods to unregister the
    newly registered objects)

    regards,

    Arndt

    martin ruff wrote:
    > Hi,
    > I have a table cm_user with about 40000 users
    > the CayenneDataObject CmUser has a lot of relationsships to other
    > objects, means is about 2K each object
    > now I have the follwoing code:
    > SelectQuery q = new SelectQuery(CmUser.class);
    > ResultIterator it = null;
    >
    > // ResultIterator operations all throw checked CayenneException
    > try
    > {
    > // special "performIteratedQuery" method is used
    > it = ctxt.performIteratedQuery(q);
    >
    > while(it.hasNextRow())
    > {
    > // ResultIterator always returns data rows
    > Map row = it.nextDataRow();
    > CmUser cmuser = (CmUser)ctxt.objectFromDataRow("CmUser",
    > row);
    > System.out.println("login: " + cmuser.getLogin());
    > }
    > }
    > catch(CayenneException ex)
    > ....
    >
    > is it correct that the datacontext caches all object that I get by:
    > CmUser cmuser = (CmUser)ctxt.objectFromDataRow("CmUser", row); ?
    > which means at the end I have 40000 CmUser objects in memory?
    > if this is the case, is there a way to prevent the datacontext from
    > caching objects?
    >
    > What is the "memory" and "performance" best way to solve the problem,
    > that in my code I HAVE to access EVERY user?
    > thanks for help
    > martin



    This archive was generated by hypermail 2.0.0 : Sat Mar 08 2003 - 07:37:14 EST