Re: Memory management and returned values from methods...

2011-07-15 Thread Kevin Muldoon
You make a very compelling point. On Jul 15, 2011, at 4:36 PM, Scott Ribe wrote: > On Jul 15, 2011, at 1:38 PM, Kevin Muldoon wrote: > >> However, there must be a better way than giving up control of releasing my >> objects to NSAutoreleasePool. > > How is this giving up control? There's alwa

Re: Memory management and returned values from methods...

2011-07-15 Thread Scott Ribe
On Jul 15, 2011, at 1:38 PM, Kevin Muldoon wrote: > However, there must be a better way than giving up control of releasing my > objects to NSAutoreleasePool. How is this giving up control? There's always an NSAutoreleasePool provided by the run loop which cleans up between handling events; all

Re: Memory management and returned values from methods...

2011-07-15 Thread Hank Heijink (Mailinglists)
On Jul 15, 2011, at 3:38 PM, Kevin Muldoon wrote: > Hey guys, > > I know of at least one way to fix this memory leak but I'm hoping to find a > few more ways. > > I'm chewing through a text file of 205,960 lines in a C while loop. All is > good until MyObject returns a value. Of course the ret

Re: Memory management and returned values from methods...

2011-07-15 Thread David Duncan
On Jul 15, 2011, at 12:38 PM, Kevin Muldoon wrote: > while (fgets(buffer, sizeof(buffer), filePointer) != NULL) { > > NSString *line = [[NSString alloc] > initWithString:[NSString stringWithFormat:@"%s", buffer]]; You could use -[NSString initWithUTF8String:] instead. Addi

Memory management and returned values from methods...

2011-07-15 Thread Kevin Muldoon
Hey guys, I know of at least one way to fix this memory leak but I'm hoping to find a few more ways. I'm chewing through a text file of 205,960 lines in a C while loop. All is good until MyObject returns a value. Of course the return value set to autorelease (Well, I suppose it would auto