• 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
Garbage collection problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Garbage collection problem


  • Subject: Garbage collection problem
  • From: Dent John <email@hidden>
  • Date: Wed, 9 Jan 2008 10:45:57 +0000

Hi guys,

I've just stumbled upon a rather odd problem. I was working on a project that I thought had GC enabled. It turned out that, for the debug targets at least, GC was not enabled correctly and so the project was falling back on retain/release.

This was working basically fine as the codebase had previously been written for retain/release. Only the new stuff doesn't have retain/ release code.

I enabled GC properly last evening and now there's a few errors cropping up. For example, in a classes init method, I get it to NSLog the self pointer. Then, after some time, I see errors relating to the class. So I attached a debugger and, sure enough, the object has somehow 'gone'.

For example, from Console.app:

09/01/2008 10:29:29 DAB Controller[6012] I am a DABSyncedController (<DABSyncedLoggingClient: 0x10dab30>). I am at 0x10dab30.
... some seconds later, from a different method ...
09/01/2008 10:29:54 DAB Controller[6012] I am still a DABSyncedController (<DABSyncedLoggingClient: 0x10dab30>). I am now at 0x10dab30.
... then later still, initiated by SyncServices ...
09/01/2008 10:29:55 DAB Controller[6012] *** -[NSCFArray client:mightWantToSyncEntityNames:]: unrecognized selector sent to instance 0x10dab30
09/01/2008 10:29:55 DAB Controller[6012] ISyncManager: exception raised during sync alert callout. A session will not be created: *** - [NSCFArray client:mightWantToSyncEntityNames:]: unrecognized selector sent to instance 0x10dab30


After attaching the debugger:

(gdb) po (id)(0x10dab30)

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xfef252df
...
(gdb) p (id)(0x10dab30)
$1 = (id) 0x10dab30
(gdb) p *(id)(0x10dab30)
$2 = {
  isa = 0xfef252bf
}

That indicates to me the object has been garbage collected.

My query is, first, how can this be?! But second, is there anything I can or should be doing to influence the GC? Or even if I could just debug GC events it might help me understand why the GC is collecting my object.

Any pointers gratefully received!

Thanks,
denty.

--
http://www.QQdd.eu/

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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: Garbage collection problem
      • From: Jonathon Mah <email@hidden>
  • Prev by Date: Re: Text Editing without NSTextView?
  • Next by Date: Re: Problem In Accessing NSDistantobject
  • Previous by thread: Re: Problem In Accessing NSDistantobject
  • Next by thread: Re: Garbage collection problem
  • Index(es):
    • Date
    • Thread