Here is my code. Memory has been constantly increasing,when the viewDidLoad
method is called.I guess that local variable data
is not released.But why?
- (void)viewDidLoad {
[super viewDidLoad];
NSData *data = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"wakeup.pcm" ofType:nil]];
NSMutableData *mData = [NSMutableData dataWithData:data];
int readLength = 0;
while (readLength < mData.length) {
if (mData.length - readLength > EVERBUFFERLEN) {
NSData *data = [mData subdataWithRange:NSMakeRange(readLength, EVERBUFFERLEN)];
readLength += EVERBUFFERLEN;
data = nil;
}
}