• 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: Running out of memory with Core Data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Running out of memory with Core Data


  • Subject: Re: Running out of memory with Core Data
  • From: John Timmer <email@hidden>
  • Date: Tue, 26 Jul 2005 10:46:28 -0400

> I added autorelease pools and it no longer runs out of memory.
> Thanks for the help.
>
> Unfortunately, it still remains TERRIBLY slow.  I used Shark but it
> seems that the calls that take the most time are private methods like
> _NSGetUsingKeyValueGetter and such.  To import 10 accounts with 100
> to 2000 transactions each takes several minutes.

I'm assuming that you're running through a loop in this process.  In
general, the two things that kill performance in a loop are object creation
and message sending.  Some potential ways to avoid these issues:

Make custom objects with accessor functions.  Use these instead of the
key/value coding ones, and you cut down on messages.  If you don't need to
update anything based on the values set during the loop, make accessors that
don't trigger key/value observing notifications and do a single update at
the end.

Where possible, replace message calls to NSStrings and NSArrays with the
equivalent CoreFoundation functions.

Use a single mutable item instead of re-allocating the item each time
through the loop.  It's typically less expensive to replace a mutable
string's content than to make a new one.

Consider popping the autorelease pool every hundredth time through the loop,
rather than doing so at each pass.


More experienced coders can no doubt give more suggestions, or tell me which
ones I mentioned are bad ideas....

JT

_______________________________________________
This mind intentionally left blank


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

This email sent to email@hidden

References: 
 >Re: Running out of memory with Core Data (From: "Ian G. Gillespie" <email@hidden>)

  • Prev by Date: Re: Is this a bug in setKeys:triggerChangeNotificationForDependentKey:?
  • Next by Date: Re: Enable PopUp if NSTextField > 0
  • Previous by thread: Re: Running out of memory with Core Data
  • Next by thread: Re: Running out of memory with Core Data
  • Index(es):
    • Date
    • Thread