Re: Memory management
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.