Re: NSObject Category
Re: NSObject Category
- Subject: Re: NSObject Category
- From: j o a r <email@hidden>
- Date: Sun, 21 Aug 2005 15:37:13 +0200
On 21 aug 2005, at 15.08, Marco Maniscalco wrote:
I'm curious if I am allowed to extend NSObject!? I have some leaks
which are not easy to track (network-related).
So my idea is to extend NSObject's -(id)init; method to keep track
if (and when) an object of specific type ist beeing deallocated.
I'm getting 10 (SIGBUS) if I NSLog() status to console. If there is
no MSLog() the error occurs. Any ideas?
A couple of things:
1) All objects are not managed via ObjC alloc/dealloc AFAIK. Some are
created as CoreFoundation "objects" that are toll-free bridged to
ObjC objects, and you will not see them using this approach. There
are other tools, lika "leaks" and ObjectAlloc, that can help you
track leaks more efficiently.
2) If you implement a method in a category, it will replace any
method with the same name in the original class. In other words, you
need to be very sure that you replicate all the essential behaviour
from the original method that you replace.
3) It seems that there are a handful of classes that doesn't take
kindly to overriding init, or at least calling their description
method before they have been properly initialized. You can perhaps
work around that by changing your log method to something like this:
NSLog(@"observed init: <%@, %x>", [self className], self);
j o a r
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden