Re: running out of NSPipes
Re: running out of NSPipes
- Subject: Re: running out of NSPipes
- From: justin webster <email@hidden>
- Date: Sat, 19 Apr 2008 14:21:40 +1200
I guess it may be a bug.
I achieved more or less the same thing bypassing NSTask and NSPipe
and now have no issues with resource management.
the trick, I think, was fflush() and pclose(). perhaps NSPipe is
missing some tidy-up code.
there probably are more efficient ways of doing this but efficiency
is not really a concern in my case.
for the record - here's an example which works:
int f;
for(f=0; f<5000; f++){
fflush(nil);
FILE *rtn = popen([@"ls" cString], [@"r" cString]);
//here we use the output of the pipe
pclose(rtn);
}
thanks for the help
justin
On 19/04/2008, at 12:15 PM, Ken Thomases wrote:
On Apr 18, 2008, at 6:05 PM, justin webster wrote:
I'm pretty sure I've got everything alloc'ing and releasing in the
right way
I agree. It all looks correct. It may very well be a bug in the
framework.
One last thing to check: does some part of your code register for
the NSTaskDidTerminateNotification notification, presumably without
specifying a task object, but listening for all of them? If so,
might it be retaining the notification object which is the task
object?
If there's no other explanation, I recommend that you file a bug at
bugreport.apple.com.
That said, to accomplish what you need I recommend that you use
sysctl(3) to get the information from the system directly without
launching the ps process. Here's some code from Apple that you can
adapt: http://developer.apple.com/qa/qa2001/qa1123.html
Good luck,
Ken
_______________________________________________
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