Re: NSTimer firing issue
Re: NSTimer firing issue
- Subject: Re: NSTimer firing issue
- From: Matt Neuburg <email@hidden>
- Date: Sat, 24 Jul 2004 11:32:23 -0700
On Fri, 23 Jul 2004 12:20:37 -0700, Julian Pellico <email@hidden>
said:
>
Matt, your solution was right on. Wow, those Cocoa engineers thought
>
of everything...
>
>
The idea I came up with before I went to bed was to post an event
>
which should get picked up by the main thread. But that would be a bit
>
more code.
Incidentally, I hope you're aware that code run in a thread, having no run
loop, has no automatic autorelease pool. This means that if you call any
methods that generate autoreleased objects, such as [NSString
stringWithFormat:], you will leak memory unless you wrap such calls with an
autorelease pool yourself. The surprise for me was that this includes code
triggered by timers and delays, something I was not aware of until last
week, when I was told by a user that my app, MemoryStick, was leaking
memory, which I tracked down to this cause. (That is the meaning of the new
tag line in my sig.) m.
>
On Fri, 23 Jul 2004 00:41:22 -0700, Julian Pellico <email@hidden> wrote:
>
> > So this thread doesn't even have a run loop. So now that I have an
>
> > idea of what's going on, does anyone have a suggestion for how to get
>
> > this code to run on my main thread?
--
matt neuburg, phd = email@hidden, <
http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<
http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
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.