Re: Heap and memory zone queries
Re: Heap and memory zone queries
On 7 Dec 2009, at 01:25, Andrew Farmer wrote:
> On 6 Dec 2009, at 13:57, email@hidden wrote:
>> 1. GC is on. Does that mean that all allocations invocation by NS*/CF* will be in the auto_zone?
>
> Not necessarily. AppKit and CoreFoundation objects are still capable of allocating unmanaged memory (via malloc(), for instance) for their use under garbage collection, so long as they clean it up when they're done with it.
>
>> 2. Are the allocations accomplished using NSZoneMalloc and CFAllocatorAllocate?
>
> Not sure on this one - I'll defer to someone more knowledgable.
>
>> 3. grepping the heap(1) output shows little data allocated to NSText* instances. Is some of the 40MB of non-object data allocated by the NSText system? for glyph storage?`
>> 4. If 3 is not utterly incorrect - why isn't the memory utilised by the NSText system flagged as being allocated by NSText*.
>
> All that #3 means is that the NSText objects themselves are small. heap(1) is relatively simplistic - it can't determine that one allocated object "belongs to" another. If a NSText object allocates a bunch of CTRun objects (for instance), those allocation will be billed against CTRun, not NSText.
Thanks for the reply Andrew. A couple more!
How does the heap manager even know that a particular allocation is associated with a certain class?
Does it maintain a table that is updated whenever an allocation occurs?
Whenever we create an instance of NSString we generally seem to receive a concrete instance of NSCFString.
Presumably NSCFString has instance/structure variables in addition to malloced data to hold the character info.
The NSCFString byte count is high so in this case heap(1) seems to be able to track the total memory allocated.
I do use instruments(1) but heap(1) is also appealing because of its low impact/snapshot nature._______________________________________________
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