• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Memory management
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory management


  • Subject: Re: Memory management
  • From: Art Isbell <email@hidden>
  • Date: Tue, 16 Mar 2004 12:10:21 -1000

On Mar 16, 2004, at 11:38 AM, Arturo Pirez wrote:

try
{
PrintWriter pw = new PrintWriter(new FileOutputStream(tableName +
".dat"));
EODatabaseChannel dc = dctx.availableChannel();
ac = dc.adaptorChannel();
if(!ac.isOpen())
ac.openChannel();


   ac.evaluateExpression(EOSQLExpression.expressionForString(stmt));
   ac.setAttributesToFetch(ac.describeResults());

I would assume that one of the immediately two preceding lines are sucking
up all the memory. Can you confirm that?

I would guess that the above aren't affecting memory usage on the client much. I think that these statements merely direct the DB server to select rows that match the expression and prepare to fetch them row by row.


   NSDictionary row = null;
   while((row = ac.fetchRow()) != null)
   {
       for(i = 0; i < fieldCount; i ++)
    {
        Object res = row.objectForKey(keys.objectAtIndex(i));
     if(i > 0)
      pw.print('\t');
     if(res != null && res != nullVal)
      pw.print(res);
    }
    pw.println();
   }
   pw.close();
  }

But by working at this level aren't you bypassing most of the EOF magic?

Yes. There should be no EO's, no snapshots, just one "row" NSDictionary and one "res" object. Each of these should lose its reference with each loop so all but the current values should be available for Java garbage collecting. I guess I would try explicitly setting each to null at the end of each loop in hopes that the garbage collector would notice. But if that fails, I'd probably try forcing garbage collecting by invoking System.gc() periodically (e.g., every 100 iterations??) at the end of the loop.


Aloha,
Art
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Memory management
      • From: Rob Lockstone <email@hidden>
References: 
 >Memory management (From: "Richard Bruch" <email@hidden>)
 >Re: Memory management (From: Arturo Pérez <email@hidden>)
 >Re: Memory management (From: "Richard Bruch" <email@hidden>)
 >Re: Memory management (From: Arturo Pérez <email@hidden>)

  • Prev by Date: Re: Memory management
  • Next by Date: RE: Memory management
  • Previous by thread: Re: Memory management
  • Next by thread: Re: Memory management
  • Index(es):
    • Date
    • Thread