Re: GC memory leak - what is it?
Re: GC memory leak - what is it?
- Subject: Re: GC memory leak - what is it?
- From: Chris Hanson <email@hidden>
- Date: Mon, 04 Jan 2010 15:30:27 -0800
On Jan 4, 2010, at 2:27 PM, Oftenwrong Soong wrote:
> According to the docs, the collector "scans" all of your objects to determine what needs to be deallocated. But in performing this scan, how does it "know" which bits in your object are pointers to other objects and which bits are just data?
The Objective-C compiler has always generated extended type information for classes, so you can not only tell what the offset of an instance variable is at runtime, but also what its type is.
When building GC-supported or GC-required, the compiler additionally provides a layout bitmap that gives the collector a faster way to know what offsets should be considered to hold strong and weak references. See class_setIvarLayout and class_setWeakIvarLayout in the Objective-C Runtime Reference; anyone constructing classes “by hand” (e.g. using objc_allocateClassPair) needs to use these if they want their classes to work under GC.
— Chris
_______________________________________________
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