Skip navigation.
 
mlGarbage collection problem
FROM : Dent John
DATE : Wed Jan 09 11:45:57 2008

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/

Related mailsAuthorDate
mlGarbage collection problem Dent John Jan 9, 11:45
mlRe: Garbage collection problem Jonathon Mah Jan 9, 12:57
mlRe: Garbage collection problem Dent John Jan 9, 14:24
mlRe: Garbage collection problem Clark S. Cox III Jan 9, 14:54
mlRe: Garbage Collection Problem Jonathan Dann Jan 9, 15:40
mlRe: Garbage collection problem mmalc crawford Jan 9, 16:55
mlRe: Garbage Collection Problem Dent John Jan 10, 10:27
mlRe: Garbage Collection Problem Bill Bumgarner Jan 10, 17:58
mlRe: Garbage Collection Problem Clark Cox Jan 10, 22:20
mlRe: Garbage collection problem Dent John Jan 13, 11:47