FROM : Jerry Krinock
DATE : Tue Jul 25 19:02:39 2006
on 06/07/25 7:42, Thom McGrath at <email_removed> 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.
DATE : Tue Jul 25 19:02:39 2006
on 06/07/25 7:42, Thom McGrath at <email_removed> 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.
| Related mails | Author | Date |
|---|---|---|
| Thom McGrath | Jul 25, 16:42 | |
| Jerry Krinock | Jul 25, 19:02 | |
| Thomas Engelmeier | Sep 12, 17:59 |






Cocoa mail archive

