Have been playing around with instruments with not much luck in figuring out how to solve this memory leak.
Firstly the code:
-(NSString *) randomizeHint:(NSString *) wordToShuffle{
NSMutableString * outputstring = [NSMutableString stringWithCapacity:[wordToShuffle length]];
NSMutableSet * usedNumberSet = [NSMutableSet setWithCapacity:[wordToShuffle length]];
for (int i=0; i<[wordToShuffle length]; i++) {
int randomnum = arc4random()%[wordToShuffle length];
while ([usedNumberSet containsObject:[NSNumber numberWithInt:randomnum]]==YES) {
randomnum = arc4random()%[wordToShuffle length];
}
[usedNumberSet addObject:[NSNumber numberWithInt:randomnum]];
[outputstring appendFormat:@"%c",[wordToShuffle characterAtIndex:randomnum]];
}
CCLOG(@"outputstring is:%@",outputstring);
return outputstring;
}
Instruments is giving me the following:
Leaked Object = NSCFString, Responsible Library = Foundation, Responsible Frame = -[NSPlaceholderMutableString initWithCapacity:]
Any ideas?
Thanks in advance.