title: Core Audio: How to store buffers in RAM before writing to disk or deleting?
body: <p>My app uses Core Audio to analyse audio buffers, recording over long time periods but only presenting a few samples of that audio to the user. To date, I have been writing everything to disk before selectively deleting files. However, it seems that the write operation is quite demanding of the hardware, and can occasionally trigger crashes if used too much. </p>
  
  <p>I'd love to have a way to avoid the write operation unless necessary, which could be done by storing audio buffers (say 1 minutes worth) in RAM before either writing to disk or releasing them from memory if not needed.</p>
  
  <p>Can anyone please advise of the most efficient way that this can be done?</p>
  
  <pre><code>renderErr = AudioUnitRender(rioUnit, ioActionFlags,
                                      inTimeStamp, bus1, inNumberFrames, THIS-&gt;bufferList);
  
  Analysis of buffer....
  
  OSStatus s;
  
  s = ExtAudioFileWriteAsync(THIS-&gt;mAudioFileRef, inNumberFrames, THIS-&gt;bufferList);
  </code></pre>
  
  <p>What would be the best container for storing the buffer before selectively running a loop to write the buffer to disk...? What would  be the best way to release the memory? </p>