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: Kazior Fukacz <email@hidden>
- Date: Wed, 7 Apr 2010 19:49:23 +0200
Hello,
How is it that it starts to malfunction after such amount of time?
Because the leak builds up over time until you run out of file
descriptors, and -[NSPipe init] finally starts returning nil.
Yeah, I figured it out like 10 minutes after I asked that question.
Found this discussion helpful:
http://www.mail-archive.com/email@hidden/msg03221.html
I think I finally managed to fix my issues. First of all, I added
these two lines, which seem to change the most:
[netstat waitUntilExit];
[netstat release];
Secondly, I'm now initializing NSPipe like this:
NSPipe *thePipe = [NSPipe pipe];
instead of:
NSPipe *thePipe = [[NSPipe alloc] init];
Finally, I made a few other changes. For an overview, take a look how
my .m code looked like before:
http://ipshowx.pastebin.com/ARFR3HRr
and how it looks now:
http://ipshowx.pastebin.com/wbpX3qGq
I know there are still a few things that I should change but as I
said, it's my first Cocoa application and I've got a lot to learn :)
Anyway, thank you all for your replies. As you can see, you pointed
me in the right direction and clarified some things to me.
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:
This email sent to email@hidden