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
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
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];
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([@"
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
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
> 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
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