String memory leak
String memory leak
- Subject: String memory leak
- From: Bruce Truax <email@hidden>
- Date: Sat, 01 Apr 2006 07:30:31 -0500
- Thread-topic: String memory leak
The command line tool "leaks" is telling me that I have an 80 byte leak of
type NSCFString everytime I execute the following method:
- (void)GLASS:(NSString *)parameterString
{
[aSurface setGlass:[NSString stringWithFormat:
@"GLASS %@", parameterString]];
[aSurface setSurfaceNumber:surfaceNumber];
surfaceNumber++;
[surfaceArray addObject:aSurface];
aSurface = [[ACSurface alloc]init];
}
Here is the Leaks report:
Leak: 0x060d9410 size=80 instance of 'NSCFString'
0xa073a674 0x0001078c 0x45474c41 0x5353204d .s.t....EGLASS M
0x4f44454c 0x20312e36 0x39313030 0x3230202d ODEL 1.6910020 -
0x312e3030 0x30303030 0x3030452d 0x30332020 1.00000000E-03
0x302e3030 0x30303030 0x3030452b 0x30302020 0.00000000E+00
0x302e3030 0x30303030 0x3030452b 0x30300054 0.00000000E+00.T
I assume that I am doing something wrong with memory management in the line:
[aSurface setGlass:[NSString stringWithFormat:
@"GLASS %@", parameterString]];
Should I be using the following instead?
[aSurface setGlass:[[NSString alloc] initWithFormat:
@"GLASS %@", parameterString]];
This really has me puzzled.
Thanks.
Bruce
_______________________________________________
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