• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: info gc-roots interpretation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: info gc-roots interpretation


  • Subject: Re: info gc-roots interpretation
  • From: Nick Rogers <email@hidden>
  • Date: Wed, 21 Oct 2009 22:14:33 +0530

Hi,
Thanks for all the valuable replies.
I tried GC Monitor instrument and this Volume pointer, is referenced by (apart from the AppController object) by just 32 bytes (non-object).
Extended detail description shows different non-related objects on different runs.
The stack trace in every such run shows a method [Volume setUpTimer].
While a thread is running with target Volume object, I call setUpTimer from this thread using [self performSelectorOnMainThread:@selector (setUpTimer) withObject:nil waitUntilDone:YES];
So I don't see any direct access to ivars from this thread. The method is as follows:


- (void)setUpTimer
{
timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(myTimerFireMethod:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode]; //Run loop needs to be running to fire the timer
}
Here timer is an ivar in Volume of type NSTimer*. Is setting timer in the above method causing the problem?


Here's the myTimerFireMethod:

- (void)myTimerFireMethod:(NSTimer*)theTimer
{
[self performSelectorOnMainThread:@selector(setUpdateStatus:) withObject:[NSNumber numberWithBool:YES] waitUntilDone:NO];
}


Thanks,
Nick

On 21-Oct-2009, at 9:09 PM, Bill Bumgarner wrote:


On Oct 21, 2009, at 1:39 AM, Nick Rogers wrote:

(gdb) info gc-roots 0x2004f9340
Number of roots: 1
Root:
0 Kind: bytes rc: 1 Address: 0x0000000200543b40 Offset: 0x0000000000000008
1 Kind: object rc: 0 Address: 0x00000002004f9340 Class: Volume


Is there a retain cycle problem.
The memory gathered by this ivar is not freed, as per Obj-Alloc Instrument.


What shall I make out of these results and how can they lead to refinement (so that all the memory referenced by this ivar is freed)?

"rc: 1" means that the object has been CFRetain'd by something. That is, something somewhere decided that it was going to bypass the collector and has failed to call CFRelease when done.


Use the ObjectAlloc instrument in Instruments to track it down. You can also:

set env MallocStackLoggingNoCompact 1
set env AUTO_REFERENCE_COUNT_LOGGING 1

And then use 'info malloc 0x2004f9340'. It'll typically show all CFRetain/CFRelease events. (But not always -- there is a bug that prevents it from showing all of 'em. However, ObjectAlloc works around it.)

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


  • Follow-Ups:
    • Re: info gc-roots interpretation
      • From: Joar Wingfors <email@hidden>
References: 
 >info gc-roots interpretation (From: Nick Rogers <email@hidden>)
 >Re: info gc-roots interpretation (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: Sending a Selector to another Class.
  • Next by Date: Re: Sending a Selector to another Class.
  • Previous by thread: Re: info gc-roots interpretation
  • Next by thread: Re: info gc-roots interpretation
  • Index(es):
    • Date
    • Thread