Re: running out of NSPipes

2008-04-19 Thread Jens Alfke
I think what's missing is a call to [handle closeFile]. From the NSFileHandle docs: Sending closeFile to a file handle does not cause its deallocation. Deallocation of a file handle deletes its descriptor and closes the represented file or channel only if the handle was created usinginitW

Re: running out of NSPipes

2008-04-19 Thread Bob Smith
On Apr 18, 2008, at 9:58 PM, justin webster wrote: I'm pretty sure I've got all objects alloc'd and released correctly. this example is the broken one: - (NSString *)myShellFunction:(NSString *)PID { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSTask *ps=[[NSTask

Re: running out of NSPipes

2008-04-18 Thread justin webster
I'm pretty sure I've got all objects alloc'd and released correctly. this example is the broken one: - (NSString *)myShellFunction:(NSString *)PID { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSTask *ps=[[NSTask alloc] init]; //NSPipe *pipe=[NSPipe pipe];

Re: running out of NSPipes

2008-04-18 Thread Jens Alfke
On 18 Apr '08, at 7:21 PM, justin webster wrote: the trick, I think, was fflush() and pclose(). perhaps NSPipe is missing some tidy-up code. I don't think so; more likely the NSPipe instances weren't being released at the end of each loop iteration. FILE *rtn = popen([@"

Re: running out of NSPipes

2008-04-18 Thread justin webster
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 effi

Re: running out of NSPipes

2008-04-18 Thread Ken Thomases
On Apr 18, 2008, at 4:23 AM, justin webster wrote: so I see at least one other thread on this topic but no real solution. the situation is: using NSTask to run a shell command and using the return. all the NSTask stuff is in a separate function which gets called repeatedly from a loop. works g

Re: running out of NSPipes

2008-04-18 Thread Scott Ribe
> I have the function wrapped in an autorelease pool and have tried > explicitly allocating and releasing the NSPipe. Sre you sure the NSPipes are being dealloc'd? Are you sure you have sent release/autorelease enough times? NSTask probably retains the NSPipes. Are you reusing the same NSTask? If

running out of NSPipes

2008-04-18 Thread justin webster
so I see at least one other thread on this topic but no real solution. the situation is: using NSTask to run a shell command and using the return. all the NSTask stuff is in a separate function which gets called repeatedly from a loop. works great until I run out out NSPipes - about 248 iterati