Re: Can I tell which object is retaining my window?
Re: Can I tell which object is retaining my window?
- Subject: Re: Can I tell which object is retaining my window?
- From: email@hidden
- Date: Sun, 30 Jul 2006 16:13:26 +0100
Quoting Shawn Erickson <email@hidden>:
On Jul 30, 2006, at 7:40 AM, email@hidden wrote:
I've got an application that was working fine until today, and now
one of the temporary windows I create is being retained. A lot.
Sample log, after I subclassed the retain and release methods to do logging:
2006-07-30 15:28:54.349 Flix[2674] DashboardWindow retained: 1
2006-07-30 15:28:54.359 Flix[2674] DashboardWindow released: 2
2006-07-30 15:28:54.367 Flix[2674] DashboardWindow retained: 1
2006-07-30 15:28:54.376 Flix[2674] DashboardWindow released: 2
2006-07-30 15:28:54.388 Flix[2674] DashboardWindow retained: 1
2006-07-30 15:28:54.406 Flix[2674] DashboardWindow retained: 2
2006-07-30 15:28:54.415 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.423 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.433 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.441 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.452 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.461 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.470 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.479 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.488 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.497 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.506 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.515 Flix[2674] DashboardWindow released: 4
2006-07-30 15:28:54.523 Flix[2674] DashboardWindow retained: 3
2006-07-30 15:28:54.524 Flix[2674] DashboardWindow released: 4
And so on. I'm creating the window in code like so:
floatingWindow = [[[DashboardWindow alloc] init] retain];
And later, releasing it normally:
[floatingWindow release];
So, as far as I can tell - something else is sending retain
messages to my window.
Look like that something is your very own code...
floatingWindow = [[[DashboardWindow alloc] init] retain];
Taking that apart...
[[DashboardWindow alloc] init]
...will return you an object that is retained (owned) by you and hence
you must send it a release message when you are done with it. Then you
proceed to send it a retain message which adds one more retain to it
and hence you must send another release to balance that retain.
-Shawn
Well, yes. That would account for one retain message. Not the hundreds
I'm showing in the log.
_______________________________________________
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