• 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: Allocating too much memory kills my App rather than returning NULL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Allocating too much memory kills my App rather than returning NULL


  • Subject: Re: Allocating too much memory kills my App rather than returning NULL
  • From: Don Quixote de la Mancha <email@hidden>
  • Date: Thu, 10 Nov 2011 18:03:42 -0800

On Thu, Nov 10, 2011 at 9:52 AM, Kyle Sluder <email@hidden> wrote:
> Read carefully: “If you allocate memory faster than the OS can re-claim it from other processes…” In other words, the system protects against apps that might've gotten trapped in an infinite loop of allocating memory. Better to kill the errant app without sacrificing other apps to its unsatisfiable demands.

I don't have a problem with the system killing runaway processes.
What I have a problem with is that calloc() NEVER returns NULL.  If it
ever did, I would have plenty of opportunity to deallocate ALL of the
memory I just allocated, and stop attempting to allocate any more.

Instead of ever receiving an allocation failure, my process is just killed.

My process isn't killed by a UNIX signal.  If it were I could use a
signal handler to free up all that memory.

calloc() and malloc() are documented to return NULL when there isn't
enough memory to satisfy the user's request.  Their implementation is
simply broken if they don't do that.
--
Don Quixote de la Mancha
Dulcinea Technologies Corporation
Software of Elegance and Beauty
http://www.dulcineatech.com
email@hidden
_______________________________________________

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

  • Follow-Ups:
    • Re: Allocating too much memory kills my App rather than returning NULL
      • From: Bill Bumgarner <email@hidden>
    • Re: Allocating too much memory kills my App rather than returning NULL
      • From: Quincey Morris <email@hidden>
    • Re: Allocating too much memory kills my App rather than returning NULL
      • From: Kyle Sluder <email@hidden>
References: 
 >Allocating too much memory kills my App rather than returning NULL (From: Don Quixote de la Mancha <email@hidden>)
 >Re: Allocating too much memory kills my App rather than returning NULL (From: Jens Alfke <email@hidden>)
 >Re: Allocating too much memory kills my App rather than returning NULL (From: Don Quixote de la Mancha <email@hidden>)
 >Re: Allocating too much memory kills my App rather than returning NULL (From: Greg Parker <email@hidden>)
 >Re: Allocating too much memory kills my App rather than returning NULL (From: Wade Tregaskis <email@hidden>)
 >Re: Allocating too much memory kills my App rather than returning NULL (From: Joar Wingfors <email@hidden>)
 >Re: Allocating too much memory kills my App rather than returning NULL (From: Don Quixote de la Mancha <email@hidden>)
 >Re: Allocating too much memory kills my App rather than returning NULL (From: Conrad Shultz <email@hidden>)
 >Re: Allocating too much memory kills my App rather than returning NULL (From: Don Quixote de la Mancha <email@hidden>)
 >Re: Allocating too much memory kills my App rather than returning NULL (From: Dave Camp <email@hidden>)
 >Re: Allocating too much memory kills my App rather than returning NULL (From: James Montgomerie <email@hidden>)
 >Re: Allocating too much memory kills my App rather than returning NULL (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: DTS
  • Next by Date: Re: Allocating too much memory kills my App rather than returning NULL
  • Previous by thread: Re: Allocating too much memory kills my App rather than returning NULL
  • Next by thread: Re: Allocating too much memory kills my App rather than returning NULL
  • Index(es):
    • Date
    • Thread