Re: Forcing garbage collection, freeing up memory, thrashing
Re: Forcing garbage collection, freeing up memory, thrashing
- Subject: Re: Forcing garbage collection, freeing up memory, thrashing
- From: Bill Bumgarner <email@hidden>
- Date: Sun, 30 Nov 2008 17:29:19 -0800
On Nov 30, 2008, at 4:44 PM, William Squires wrote:
The collector provides API for this:
objc_clear_stack(OBJC_CLEAR_RESIDENT_STACK);
NSRunLoop does this automatically as it passes through each loop.
Since you are blocking the run loop, you'll have to do this for it.
Wouldn't this make your locals go >poof!<??
It clears from just below the current stack down.
Part of the issue is that the "bottom of the stack" is not necessarily
the bottom of the stack. Under certain conditions, there can be quite
a number of additional bytes in the "red zone", including references
to objects.
The collector has to conservatively scan these bytes to make sure that
nothing is pre-reaped, but this can sometimes lead to an object
sticking around longer than it should.
objc_clear_stack() clears from the first known to be unused byte of
the stack onwards, thus clearing out these phantom references.
b.bum
_______________________________________________
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