I have a memory growth seen in xcode instruments, so after trying to eliminate the problem, i have seen that in my audio buffer callback method, there is a block of code that when i erase, the problem is been solved.
so , this callback happens many times a second and cause the growth:
static OSStatus recordingCallback(void *inRefCon,
AudioUnitRenderActionFlags *ioActionFlags,
const AudioTimeStamp *inTimeStamp,
UInt32 inBusNumber,
UInt32 inNumberFrames,
AudioBufferList *ioData)
{
AudioBuffer buffer;
buffer.mNumberChannels = 1;
buffer.mDataByteSize = inNumberFrames * 2;
//NSLog(@"%ld",inNumberFrames);
buffer.mData = malloc( inNumberFrames * 2 );
// Put buffer in a AudioBufferList
AudioBufferList bufferList;
bufferList.mNumberBuffers = 1;
bufferList.mBuffers[0] = buffer;
OSStatus status;
status = AudioUnitRender(audioUnit,
ioActionFlags,
inTimeStamp,
inBusNumber,
inNumberFrames,
&bufferList);
..
..
..
free(buffer.mData);
can you see some line here that can cause that? the buffer.mdata is free.
there is something else that i dont free, that is growing .
thanks.
Looks like you forgot to release your
bufferList.