Re: Memory limits under Garbage Collection, NSMutableData vs. malloc()
Re: Memory limits under Garbage Collection, NSMutableData vs. malloc()
- Subject: Re: Memory limits under Garbage Collection, NSMutableData vs. malloc()
- From: "Shawn Erickson" <email@hidden>
- Date: Tue, 13 Nov 2007 16:29:10 -0800
On 11/13/07, Nick Zitzmann <email@hidden> wrote:
>
> On Nov 13, 2007, at 3:30 PM, Rick Hoge wrote:
>
> > 2007-11-13 17:11:06.686 MyApp[10413:10b] Here1
> > MyApp(10413,0x37cf60) malloc: *** mmap(size=788488192) failed (error
> > code=12)
> > *** error: can't allocate region
> > *** set a breakpoint in malloc_error_break to debug
> > 2007-11-13 17:11:06.699 MyApp[10413:10b] Here2
>
> This is what happens when memory allocation fails due to running out
> of space. Remember, the maximum amount of RAM an application can
> allocate in a 32-bit space is 4 GB.
In this case he likely has that much available still in his processes
address space however not as a contiguous block. In situations like
this it may be best to make this type of allocation early in the
applications life-cycle to avoid virtual memory space fragmentation
issues that can cause it to fail later on after the application has
been running for a while.
Note it shouldn't be wasteful to do this since the allocation should
only reserve the memory and not physical pages (those get zero filled
on page fault, aka when first accessed).
-Shawn
_______________________________________________
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