Re: static objects "autoreleased with no pool in place - just leaking"
Re: static objects "autoreleased with no pool in place - just leaking"
- Subject: Re: static objects "autoreleased with no pool in place - just leaking"
- From: Glenn Andreas <email@hidden>
- Date: Fri, 13 Feb 2004 08:29:36 -0600
At 4:05 AM -0800 2/13/04, m wrote:
On Feb 13, 2004, at 12:45 AM, j o a r wrote:
In an OO context you would not have things like this dangling
around, but would instead associate them with a class.
Now riddle me this: why are there examples of this kind of thing in
Cocoa itself? For example, there are a slew of NSString objects that
are available, or "dangling around". Notifications are one example
(NSWindowDidBecomeKeyNotification, etc).
Because NXConstantStrings (or whatever they're called now) can be
generated by the compiler as a "static" object - and constant strings
are the only things that work like that (the compiler produces a
structure with a pointer that will refer to the constant string class
and the rest of the required data like length and contents). This is
how the whole @".." thing works - and thus those can be used to
initialize variables.
One could argue there should be support for other static objects like
this, but that's another thread for another mailing list.
NSWindowDidBecomeKeyNotification isn't actually a notification (i.e.,
it's not an instance of NSNotification) - it's just another string
constant used in notifications.
--
Glenn Andreas email@hidden
mondo blobbo, Cythera, Theldrow, oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.