Memory Leak with NSMutable String
Memory Leak with NSMutable String
- Subject: Memory Leak with NSMutable String
- From: "Alexander F. Hartner" <email@hidden>
- Date: Mon, 26 Jan 2004 13:14:28 +0200
The following code uses as diagnosed with ObjectAlloc and MallocDebug
more and more memory. It seems that NSMutableString don't get properly
released. I am still quite new to Objective C and most likely am doing
something incredible stupid. Any suggestions are welcome.
Thanks
Alex
#import <Foundation/Foundation.h>
#include <stdio.h>
void doOtherStuff()
{
NSMutableString *data = [NSMutableString stringWithCapacity:1000];
[data appendString:@"DATA"];
[data release];
printf("Interation \n");
}
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// insert code here...
NSLog(@"Hello, World!");
int counter=0;
for (counter=0; counter<1000000;counter++)
{
doOtherStuff();
}
[pool release];
return 0;
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.