Hello,
i feel like having memory leak in the next code
while([outData length] + ptr[currentPacket].mDataByteSize < inBytesToGet && currentPacket < packetsCount)
{
NSLog(@" ++> %d", [aData retainCount]) ;
NSInteger sO = ptr[currentPacket].mStartOffset ;
NSInteger dS = ptr[currentPacket].mDataByteSize ;
NSLog(@" get: cP: %d tP: %d mStartOffset: %d mDataByteSize: %d", currentPacket, packetsCount, sO, dS) ;
NSData *copyRange = [aData subdataWithRange: NSMakeRange(sO,dS)] ;
NSLog(@" => %d", [aData retainCount]) ;
[outData appendData:copyRange] ;
ptr[currentPacket].mStartOffset = bytesFilled + inOffset ;
[outPackets appendBytes: &ptr[currentPacket] length: sizeof(AudioStreamPacketDescription)] ;
currentPacket++ ;
bytesFilled += dS ;
}
in each iteration aData which is NSData class increase its retainCount by 1 and it happenes after [aData subdataWithRange: NSMakeRange(sO,dS)] call... i can't understand why.