• 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: "Richard Bruch" <email@hidden>
  • Date: Tue, 16 Mar 2004 19:39:52 +0100

Hi Arturo

here is my code so you can see what goes on. The question is whether there
is a means to get this code working for large queries.

  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());
   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();
  }
  catch(Exception e)
  {
      System.out.println("Error occured: " + e);
      try
   {
       if(ac != null)
     ac.cancelFetch();
   }
   catch(Exception xe)
   {
   }
  }

Thank you

Richard


----- Original Message -----
From: Arturo Pirez <email@hidden>
To: Richard Bruch <email@hidden>
Cc: <email@hidden>
Sent: Tuesday, March 16, 2004 7:26 PM
Subject: Re: Memory management


>
> On Mar 16, 2004, at 1:09 PM, Richard Bruch wrote:
>
> > Hi all,
> >
> > a Java question to the smartest Java community in the world.
> >
> > WO allows to quickly build HTML interface to a database so it seems
> > reasonable
> > to use it to execute flexible data exports(XML or plain text for
> > example).
> > However with Java(unlike C) it is not quite trivial if the
> > tables(queries) are
> > large. I tried to export a subset of a large table using raw sql
> > EOAdaptorChannel methods. Even in that rather inexpensive case the
> > memory
> > consumption after just 300 000 rows reaches 1 GB which is hardly
> > acceptable.
> > Is there a means to deallocate memory(in this case the dictionaries
> > returned
> > by EOAdaptorChannel.fetchRow()) in some predictable way or to force the
> > virtual machine to reclaim garbage ?
> >
> > Or should i rather forget doing such things in Java ?
> >
>
> We used to do that sort of thing all the time with Java/JDBC.  So it's
> probably not a java issue.
>
> Can you be more specific as to what you're doing?  Are you asking
> what's the best way to clear out the EOF snapshots etc?
>
> ----
> WO in philadelphia - wanna cheesesteak with that?
> Please visit webobjects.meetup.com.
_______________________________________________
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: Arturo Pérez <email@hidden>
References: 
 >Memory management (From: "Richard Bruch" <email@hidden>)
 >Re: Memory management (From: Arturo Pérez <email@hidden>)

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