On Thu, Oct 30, 2008 at 8:56 AM, Jerry Krinock <[EMAIL PROTECTED]> wrote:
>
> On 2008 Oct, 25, at 21:58, Ken Thomases wrote:
>
>> On Oct 25, 2008, at 11:48 PM, Jerry Krinock wrote:
>>
>>> Why did malloc say "No more!" on his Mac, but not on mine?
>>
>> Because you didn't let yours run amok for long enough.
>
> Thank you, Ken.  I thought I did, but maybe I didn't.
>
>> If your app is leaking memory on a (more or less) continuous basis, it
>> will eventually get an error like your user got.  You just have to let it
>> keep at it.
>
> An internet search shows me that the error message...
>
>   malloc: *** mmap(size=2097152) failed (error code=12)
>
> is quite common.
>
> What is the significance of the number 2097152, besides the fact that it is
> 2^21?  I suppose is the limit of how much malloc will give any app?  2097152
> what?  What are the units?  Is this set or documented anywhere?

The units are bytes.

The significance is probably that this is the chunk size that malloc
uses when requesting memory from the operating system.

For efficiency, malloc doesn't call out to the OS every time you call
it. For small allocations, it makes one call out to the OS for a big
block of memory, and then divides it up into pieces. Apparently it
asks for 2MB at a time.

In the end the number is not really important. All it means is that
you've exhausted your address space and therefore your app must die.

Mike
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to