Re: Problems with repetetive execution of netstat using NSTask and NSTimer
Re: Problems with repetetive execution of netstat using NSTask and NSTimer
- Subject: Re: Problems with repetetive execution of netstat using NSTask and NSTimer
- From: William Squires <email@hidden>
- Date: Thu, 8 Apr 2010 21:57:47 -0500
Can you put a watchpoint on the expression "pipe == nil"? Maybe that
would show you where it's going kablooey!
On Apr 6, 2010, at 2:08 PM, Kazior Fukacz wrote:
Thanks for your answers!
By the way, are you using garbage collection? If not, then
you're leaking several objects (those pointed to by 'netstat',
'pipe', and 'string').
Yeah, I suspect that the pipes (and corresponding NSFileHandles)
are indeed leaking, and that's the real problem. You may also
want to create and launch NSTask instances inside an exception
handler, since it and NSFileHandle/NSPipe can raise some
unexpected exceptions.
I'm coding under Tiger using XCode 2.5. As far as I know garbage
collection was introduced in XCode 3 which came with Objective-C
2.0, am I right?
Anyway, I tried putting a NSAutoreleasePool and draining it every
time my method finishes its work. I also tried releasing the pipe
manually. Still no luck.
However, putting "assert(pipe != null)" right before "[netstat
setStandardOutput: pipe];" ended up with "(...)/IPShowX/IPShowX.m:
32: failed assertion `pipe != nil'". It happened about 15 minutes
after launching. This might be helpful in determining what the
reason of this problem might be. As we can see it is NSPipe-
related. Something about allocation, initialization and releasing?
How is it that it starts to malfunction after such amount of time?
Regards,
kaziorvb
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40satx.rr.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden