Search code examples
iosnsfilehandle

Why I use NSFileHandle read file line by line,the memory usage grows higher and higher?


When I use DDFileReader from How to read data from NSFileHandle line by line? to read a large file (about 37M),the memory usage grows higher and higher.

DDFileReader * reader = [[DDFileReader alloc] initWithFilePath:[[NSBundle mainBundle] pathForResource:@"tb_sentence" ofType:@"sql"]];
 NSString * line = nil;
while ((line = [reader readLine])) 
{
  NSLog(@"read line: %@", line);
}
 [reader release];

Solution

  • I have resoveed this bug.That is because I have enabled Zombie Objects.Closed it,