• 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
Out of memory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Out of memory


  • Subject: Out of memory
  • From: Miguel Arroz <email@hidden>
  • Date: Wed, 28 Nov 2007 13:38:25 +0000

Hi!

I'm having an Out of memory exception (and consequently application death) that I can't figure out why it happens. I suspect it's because I'm assuming something about the WO behaviour that is not correct (as usual).

The problem is this: I have an action that creates some test data. Depending on the parameters I feed on the page, it may create many many objects (50k, or more). Of course, this takes time, and the request will at some point hang (ie, the browser gets an error from the adaptor) but I don't care, as this is used only during testing.

  The problematic part of the code is something like this:

  for( int i = 0; i < numberOfObjectsToCreate; i++ ) {
    EOEditingContext theContext = ERXEC.newEditingContext();
    theContext.lock();

    // Create stuff here

    theContext.saveChanges();
    theContext.unlock();
    theContext.dispose();

    if( i % 50 == 0 ) {
      NSLog.out.appendln("Generating object " + i + "...");
    }
  }

The "Create stuff here" creates and updates a few objects, nothing very heavy.

The problem is that, if numberOfObjectsToCreate is too big, this starts getting slower and slower (more time passes between the log lines) until it eventually blows up with Out Of Memory. Currently it's dying when i is about 3100, which is not a very impressive number.

My assumption is that on every cycle, all the objects I created in the context are saved and then garbage collected. Obviously that doesn't seem to be happening. So:

1) Why? (I know I know, this is a good candidate for the "How to ask smart questions", but here it goes anyway)

2) How can I debug this? How can I know what objects are not being GCed and why?

  Yours

Miguel Arroz

Miguel Arroz
http://www.terminalapp.net
http://www.ipragma.com



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Out of memory
      • From: Chuck Hill <email@hidden>
    • Re: Out of memory
      • From: RenĂ© Bock <email@hidden>
  • Prev by Date: Re: WO command line application
  • Next by Date: Re: WO command line application
  • Previous by thread: Re: WO command line application
  • Next by thread: Re: Out of memory
  • Index(es):
    • Date
    • Thread