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

Re: memory warnings


  • Subject: Re: memory warnings
  • From: John Stiles <email@hidden>
  • Date: Wed, 12 Mar 2008 14:22:25 -0700

I'm sure what you say is true. If you try to allocate right up to the limit, yes, you will eventually hit failures.
But knowing your heap is, say, 90% full is still pretty useful information. You can jettison stuff and try to reduce your footprint well before you reach "the wall."


Jens Alfke wrote:

On 12 Mar '08, at 11:00 AM, John Stiles wrote:

You can dive into BSD to get some values which might help you.

I'm not an expert on this, but I've listened in on email threads where OS X kernel engineers were giving answers.


Trying to preflight memory allocations is, basically, not feasible. Your process's address space gets fragmented, so just because X amount is free doesn't mean an attempt to allocate X will succeed.

Going 64-bit will keep you from running out of address space. (The next limit you hit will probably be when the app's working set exceeds available physical RAM, and the system will start to thrash like crazy. After that, you might fill up the hard drive and run out of swap space, in which case you'll crash.)

If the data you're manipulating comes directly from files, try to memory-map them instead of copying the contents into your heap. That can really help.

—Jens
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >memory warnings (From: Alexander Cohen <email@hidden>)
 >Re: memory warnings (From: Nick Zitzmann <email@hidden>)
 >Re: memory warnings (From: John Stiles <email@hidden>)
 >Re: memory warnings (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Controlling line tightening
  • Next by Date: Re: BitMap data format and autorelease
  • Previous by thread: Re: memory warnings
  • Next by thread: Mute System
  • Index(es):
    • Date
    • Thread