NSMutableArray * a = [NSMutableArray array]; for (int i = 0; i <10000 data-blogger-escaped-br="" data-blogger-escaped-i="">void * p = malloc (33333); NSData * data = [NSData dataWithBytes: p length: 3333]; free (p); [A addObject: data]; } [NSThread sleepForTimeInterval: 5.5]; NSLog (@ "Removing objects ..."); [A removeAllObjects];
removeAllObjects, the program memory is not diminished. How it happened?
Reply:
Look at the code, it should be no problem.
However, not the best time variable blank.
Reply:
I myself have been resolved. There are 99% more likely to NSData the BUG, I must first try to call [NSData setLength: 0] can be truly free memory. Apple is looking at ways to react to this problem.
Reply:
In [a addObject: data]; followed by a [data release]; you do not add this sentence data out how to release
No comments:
Post a Comment