Re: Creating many NSPipes
Re: Creating many NSPipes
- Subject: Re: Creating many NSPipes
- From: Jerry Krinock <email@hidden>
- Date: Tue, 25 Jul 2006 10:02:39 -0700
- Thread-topic: Creating many NSPipes
on 06/07/25 7:42, Thom McGrath at email@hidden wrote:
> I'm attempting to run a shell script many times (in the hundreds) and
> need to read the output. So I create the NSPipe and all, but after so
> many, it starts returning nil. I have tried releasing the NSPipe when
> I'm done with it, but that doesn't help. It seems like I'm running
> out of memory or something. How can I solve this problem?
I ran into this problem last year. It was not sufficient to release the
NSPipes because I was also getting file handles (NSFileHandle) for each one
using -fileHandleForReading. According to the documentation, these file
handles are "automatically" released when the pipe is deallocated. Read
carefully "automatically" <=> "autoreleased". Implementing a local
autorelease pool and releasing it with each NSPipe solved the problem.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden