Re: Memory fragmentation
Re: Memory fragmentation
- Subject: Re: Memory fragmentation
- From: "Erik M. Buck" <email@hidden>
- Date: Fri, 7 Sep 2001 15:33:48 -0500
>
Because Obj-C relies so much on dynamic memory allocation, is
>
fragmentation a concern, especially for apps that allocate/free large
>
chunks of memory continually?
>
It can be a problem. See NSZone for a partial solution. In practice, it is
not too bad because Mach usually allocates memory in increments of a "page"
and it can rearrange the logical pages in physical memory very efficiently.
In other words, a page that used to be used but is no longer used costs
essentially nothing and the order of pages in physical memory does not have
to be related to the order in which they were allocated. Elimination of
"page" fragmentation happen automatically. Fragmentation within a "page" is
possible, but it is unlikely to be a problem since every byte within a
single page enjoys a certain locality of reference ;-)