Re: release not done right away
Re: release not done right away
- Subject: Re: release not done right away
- From: Nicolas Berloquin <email@hidden>
- Date: Wed, 21 Apr 2004 13:05:00 +0200
ok I found what I believe is the guilty instance.
I'm using an NSTimer to prune my NBPeer after a couple seconds.
The NBPeer is inside the userInfo of the timer. And the Timer is an
autoreleased
object... which holds onto it until the main loop's pool autoreleases
it...
So I'll have to put all those timers inside my own pool that I cleaup
when I need to.
strange though that minutes or hours can pass before the main pool gets
emptied
(when the app is not in front or hidden).
On 21 avr. 04, at 12:57, A.M. wrote:
If your dealloc takes "perceptible" time, it's better to have a
cleanup method run first to handle that. Then you know for sure when
this action will take place. Implement dealloc to release previous
alloc'd objects only. Your objects are probably not being dealloc'd
right away because some GUI element or other object is holding on to
them until the next event loop iteration. Remember- release means
decrement retain count, not nuke this object immediately.
On Apr 21, 2004, at 12:00 PM, Nicolas Berloquin wrote:
Hello (so many questions ;-))
I'm having (as usual) a very weird problem.
I have some objects that are allocated like:
[[NBPeer alloc] init];
I never call autorelease on them, only release when I'm done with
them.
I setup an NSLog inside their dealloc, and I noticed that when my app
is in
the background and I switch to it, I get a batch of dealloc logs
showing up.
I would understand it for autorelease and the event loop being passed
through
at that time, but I thought that release happened right away.
Any idea what could cause this ???
PS this is a problem because this object's dealloc is not completely
instanteneous,
and switching to my app then takes some "perceptible" time, when
otherwise those
objets should get deallocated every so often...
_______________________________________________
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.
,,,,,,,,,,,,,,,,,,,,,,,,,,,
AgentM
email@hidden
,,,,,,,,,,,,,,,,,,,,,,,,,,,
_______________________________________________
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.