添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I have what at the moment seems like an unsolvable EXC_BAD_ACCESS problem. I've tried enabling NSZombie, as seems to be the advice in many posts but I'm dealing with c pointers and not obj c objects so I'm not getting any useful debugging information.

The way my code works is that in advance of it needing some audio from disk I detach a new posix thread passing it a pointer to information about the audio I want. Then I read some samples. The reason I chose posix over NSThread or NSOperation is because it seemed to perform quicker. My audio is quite cpu intensive so I need to read audio as quick as possible.

How can I fix this bad access error? It doesnt occur all of the time. Sometimes it seems to happen when the application is very busy. Very occasionally it doesnt happen at all.

Is there anyway I could just throw a try catch around this as a quick fix? How else can I investigate causes of this is happening?

Edit This is a link to a seperate question I asked but it is related to the same problem

[Threading for intense io][1]

//detachnewthread gets called from remoteio callback
void detachnewthread(AudioSourceOBJ str)
    //..... code removed for brevity
    if(str)
        int rc;
        rc = pthread_create(&str->thread, NULL, FetchAudio, (void *)str);
        if (rc){
            printf("ERROR; return code from pthread_create() is %d\n", rc);
            exit(-1);
void *FetchAudio(void *threadid)
    AudioSourceOBJ soundptr=threadid;

AudioUnitSampleType *outSamplesChannelLeft;
AudioUnitSampleType *outSamplesChannelRight;
outSamplesChannelLeft                 = (AudioUnitSampleType *) soundptr->queuebuffer->ABL->mBuffers[0].mData;
outSamplesChannelRight  = (AudioUnitSampleType *)soundptr->queuebuffer->ABL->mBuffers[0].mData;
// ExtAudioFileRef audioFileRef;
// result=  ExtAudioFileOpenURL(str->path, &str->audioFileObject);
AudioStreamBasicDescription importFormat = {0};
size_t bytesPerSample = sizeof (AudioUnitSampleType);
// Fill the application audio format struct's fields to define a linear PCM, 
//        stereo, noninterleaved stream at the hardware sample rate.
importFormat.mFormatID          = kAudioFormatLinearPCM;
importFormat.mFormatFlags       = kAudioFormatFlagsAudioUnitCanonical;
importFormat.mBytesPerPacket    = bytesPerSample;
importFormat.mFramesPerPacket   = 1;
importFormat.mBytesPerFrame     = bytesPerSample;
importFormat.mChannelsPerFrame  = 2;                    // 2 indicates stereo
importFormat.mBitsPerChannel    = 8 * bytesPerSample;
importFormat.mSampleRate        = 44100;
ExtAudioFileSetProperty (
                                     engineDescribtion.audiofilerefs[soundptr->audioindex],
                                     kExtAudioFileProperty_ClientDataFormat,
                                     sizeof (importFormat),
                                     &importFormat
UInt32 numberofframestoread=(soundptr->amounttoread);
AudioBufferList *bufferList;
bufferList = (AudioBufferList *) malloc (
                                         sizeof (AudioBufferList) + sizeof (AudioBuffer) * (1)
// initialize the mNumberBuffers member
bufferList->mNumberBuffers = 2;
// initialize the mBuffers member to 0
AudioBuffer emptyBuffer = {0};
size_t arrayIndex;
for (arrayIndex = 0; arrayIndex < 2; arrayIndex++) {
    bufferList->mBuffers[arrayIndex] = emptyBuffer;
// set up the AudioBuffer structs in the buffer list
bufferList->mBuffers[0].mNumberChannels  = 1;
bufferList->mBuffers[0].mDataByteSize    = numberofframestoread * sizeof (AudioUnitSampleType);
bufferList->mBuffers[0].mData            = (AudioUnitSampleType*)calloc(numberofframestoread, sizeof(AudioUnitSampleType));
    bufferList->mBuffers[1].mNumberChannels  = 1;
    bufferList->mBuffers[1].mDataByteSize    = numberofframestoread * sizeof (AudioUnitSampleType);
    bufferList->mBuffers[1].mData            = (AudioUnitSampleType*)calloc(numberofframestoread, sizeof(AudioUnitSampleType));
// UInt32 read=(UInt32)soundptr->fetchsample;
UInt32 read_plus_half_buffer=soundptr->fetchsample;
UInt32 readdestination= read_plus_half_buffer+numberofframestoread;
UInt32 actualsamplesread=0;
actualsamplesread=numberofframestoread;
if (readdestination>soundptr->perfectframecount) {
    UInt32 readinpt1=0;
    UInt32 readoutpt1=0;
    UInt32 readinpt2=0;
    UInt32 readoutpt2=0;
    Float32 readtillendamount=0;
    readinpt1=read_plus_half_buffer;
    readoutpt1=soundptr->perfectframecount;
    readinpt2=0;
    if(read_plus_half_buffer>soundptr->perfectframecount)
        readtillendamount=numberofframestoread;
        readinpt1=read_plus_half_buffer-soundptr->perfectframecount;
    }else
        readtillendamount=soundptr->perfectframecount - readinpt1;
        readoutpt2=numberofframestoread-readtillendamount;
    actualsamplesread= readtillendamount;
    ExtAudioFileSeek(engineDescribtion.audiofilerefs[soundptr->audioindex], readinpt1);
    ExtAudioFileRead(engineDescribtion.audiofilerefs[soundptr->audioindex],&actualsamplesread , bufferList);
    int writeposition=soundptr->queuebuffer->position;
    for (int i=0; i<actualsamplesread; i++) {
        outSamplesChannelLeft[writeposition]=inSamplesChannelLeft[i];
        outSamplesChannelRight[writeposition]=inSamplesChannelRight[i];
        writeposition++;
    if (actualsamplesread!=readtillendamount) {
        UInt32 newzeroamount= readtillendamount-actualsamplesread;
        for (int j=0; j<newzeroamount; j++) {
            outSamplesChannelLeft[writeposition]=0;
            outSamplesChannelRight[writeposition]=0;
            writeposition++;
    bufferList->mBuffers[1].mDataByteSize    = readoutpt2 * sizeof (AudioUnitSampleType);
    bufferList->mBuffers[0].mDataByteSize    = readoutpt2 * sizeof (AudioUnitSampleType);
    ExtAudioFileSeek(engineDescribtion.audiofilerefs[soundptr->audioindex], 0);
    ExtAudioFileRead(engineDescribtion.audiofilerefs[soundptr->audioindex],&readoutpt2 , bufferList);
    for (int k=0; k<readoutpt2; k++) {
        outSamplesChannelLeft[writeposition]=inSamplesChannelLeft[k];
        outSamplesChannelRight[writeposition]=inSamplesChannelRight[k];
        writeposition++;
}else if(readdestination<=soundptr->perfectframecount){
    ExtAudioFileSeek(engineDescribtion.audiofilerefs[soundptr->audioindex], read_plus_half_buffer);
    bufferList->mBuffers[1].mDataByteSize    = actualsamplesread * sizeof (AudioUnitSampleType);
    bufferList->mBuffers[0].mDataByteSize    = actualsamplesread * sizeof (AudioUnitSampleType);
    // crash happens here
    if(bufferList)
   assert( ExtAudioFileRead(engineDescribtion.audiofilerefs[soundptr->audioindex],&actualsamplesread , bufferList));
    }else
        printf("NO BUFFER");
    int writeposition=soundptr->queuebuffer->position;
    for (int i=0; i<actualsamplesread; i++) {
        outSamplesChannelLeft[writeposition]=inSamplesChannelLeft[i];
        outSamplesChannelRight[writeposition]=inSamplesChannelRight[i];
        writeposition++;
    if (actualsamplesread!=numberofframestoread) {
        int zerosamples=0;
        zerosamples=numberofframestoread-actualsamplesread;
        for (int j=0; j<zerosamples; j++) {
            outSamplesChannelLeft[writeposition]=0;
            outSamplesChannelRight[writeposition]=0;
            writeposition++;
}else
    printf("unknown condition");
free(bufferList->mBuffers[0].mData); 
free(bufferList->mBuffers[1].mData); 
free(bufferList);
bufferList=nil;
soundptr->queuebuffer->isreading=NO;
// pthread_detach(soundptr->thread);  
// free(&soundptr->m_lock);
return 0;
// pthread_exit(NULL);

Edit 2

O.K I've figured out how to use malloc history. I have a big trace statement. This is the first time I've ever seen anything like this before & I don't know how to use it to help myself.

    ALLOC 0x6c67000-0x6c67fd7 [size=4056]: thread_a019c540 |start | main | UIApplicationMain | GSEventRun | GSEventRunModal | CFRunLoopRunInMode | CFRunLoopRunSpecific | __CFRunLoopRun | __CFRunLoopDoSource1 | __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ | migHelperRecievePortCallout | _XReceivedStatusBarDataAndActions | _UIStatusBarReceivedStatusBarDataAndActions | -[UIStatusBarServer _receivedStatusBarData:actions:] | -[UIStatusBarForegroundView setStatusBarData:actions:animated:] | -[UIStatusBarLayoutManager updateItemsWithData:actions:animated:] | -[UIStatusBarLayoutManager _updateItemView:withData:actions:animated:] | -[UIStatusBarItemView updateContentsAndWidth] | -[UIStatusBarTimeItemView contentsImageForStyle:] | -[UIStatusBarItemView drawText:forStyle:] | -[UIStatusBarItemView drawText:forStyle:forWidth:lineBreakMode:letterSpacing:] | -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:letterSpacing:] | -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:letterSpacing:includeEmoji:] | -[NSString(WebStringDrawing) _web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:] | -[NSString(WebStringDrawing) __web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:measureOnly:] | -[NSString(WebStringDrawing) __web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:measureOnly:renderedStringOut:] | drawAtPoint(unsigned short const*, int, WebCore::FloatPoint const&, WebCore::Font const&, WebCore::GraphicsContext*, WebCore::BidiStatus*, int) | WebCore::Font::drawSimpleText(WebCore::GraphicsContext*, WebCore::TextRun const&, WebCore::FloatPoint const&, int, int) const | WebCore::Font::drawGlyphBuffer(WebCore::GraphicsContext*, WebCore::GlyphBuffer const&, WebCore::TextRun const&, WebCore::FloatPoint&) const | WebCore::Font::drawGlyphs(WebCore::GraphicsContext*, WebCore::SimpleFontData const*, WebCore::GlyphBuffer const&, int, int, WebCore::FloatPoint const&, bool) const | WebCore::showGlyphsWithAdvances(WebCore::FontPlatformData const&, CGContext*, unsigned short const*, CGSize const*, unsigned long) | CGContextShowGlyphsWithAdvances | draw_glyphs | ripc_DrawGlyphs | ripc_RenderGlyphs | CGGlyphLockLockGlyphBitmaps | create_missing_bitmaps | CGFontCreateGlyphBitmap8 | aa_create | malloc | malloc_zone_malloc 
FREE  0x6c67000-0x6c67fd7 [size=4056]: thread_a019c540 |start | main | UIApplicationMain | GSEventRun | GSEventRunModal | CFRunLoopRunInMode | CFRunLoopRunSpecific | __CFRunLoopRun | __CFRunLoopDoSource1 | __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ | migHelperRecievePortCallout | _XReceivedStatusBarDataAndActions | _UIStatusBarReceivedStatusBarDataAndActions | -[UIStatusBarServer _receivedStatusBarData:actions:] | -[UIStatusBarForegroundView setStatusBarData:actions:animated:] | -[UIStatusBarLayoutManager updateItemsWithData:actions:animated:] | -[UIStatusBarLayoutManager _updateItemView:withData:actions:animated:] | -[UIStatusBarItemView updateContentsAndWidth] | -[UIStatusBarTimeItemView contentsImageForStyle:] | -[UIStatusBarItemView drawText:forStyle:] | -[UIStatusBarItemView drawText:forStyle:forWidth:lineBreakMode:letterSpacing:] | -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:letterSpacing:] | -[NSString(UIStringDrawing) drawAtPoint:forWidth:withFont:lineBreakMode:letterSpacing:includeEmoji:] | -[NSString(WebStringDrawing) _web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:] | -[NSString(WebStringDrawing) __web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:measureOnly:] | -[NSString(WebStringDrawing) __web_drawAtPoint:forWidth:withFont:ellipsis:letterSpacing:includeEmoji:measureOnly:renderedStringOut:] | drawAtPoint(unsigned short const*, int, WebCore::FloatPoint const&, WebCore::Font const&, WebCore::GraphicsContext*, WebCore::BidiStatus*, int) | WebCore::Font::drawSimpleText(WebCore::GraphicsContext*, WebCore::TextRun const&, WebCore::FloatPoint const&, int, int) const | WebCore::Font::drawGlyphBuffer(WebCore::GraphicsContext*, WebCore::GlyphBuffer const&, WebCore::TextRun const&, WebCore::FloatPoint&) const | WebCore::Font::drawGlyphs(WebCore::GraphicsContext*, WebCore::SimpleFontData const*, WebCore::GlyphBuffer const&, int, int, WebCore::FloatPoint const&, bool) const | WebCore::showGlyphsWithAdvances(WebCore::FontPlatformData const&, CGContext*, unsigned short const*, CGSize const*, unsigned long) | CGContextShowGlyphsWithAdvances | draw_glyphs | ripc_DrawGlyphs | ripc_RenderGlyphs | CGGlyphLockLockGlyphBitmaps | create_missing_bitmaps | CGFontCreateGlyphBitmap8 | aa_destroy | free 
ALLOC 0x6c67000-0x6c67fff [size=4096]: thread_b024f000 |thread_start | _pthread_start | __NSThread__main__ | -[NSThread main] | -[FirstViewController checkstate:] | CALayer_setter_kCAValueFloat | CALayer_setter | CA::Transaction::ensure_compat() | CA::Transaction::create() | malloc | malloc_zone_malloc 
FREE  0x6c67000-0x6c67fff [size=4096]: thread_b024f000 |thread_start | _pthread_start | __NSThread__main__ | -[NSString compare:options:] | _pthread_exit | _pthread_tsd_cleanup | free 
ALLOC 0x6c67000-0x6c67fff [size=4096]: thread_b0353000 |thread_start | _pthread_start | __NSThread__main__ | -[NSThread main] | -[FirstViewController checkstate:] | CALayer_setter_kCAValueFloat | CALayer_setter | CA::Transaction::ensure_compat() | CA::Transaction::create() | malloc | malloc_zone_malloc 
FREE  0x6c67000-0x6c67fff [size=4096]: thread_b0353000 |thread_start | _pthread_start | __NSThread__main__ | -[NSString compare:options:] | _pthread_exit | _pthread_tsd_cleanup | free 
ALLOC 0x6c67000-0x6c67fff [size=4096]: thread_b0763000 |thread_start | _pthread_start | FetchAudio | ExtAudioFileRead | ExtAudioFile::Read(unsigned long, unsigned long&, AudioBufferList*) | AudioConverterFillComplexBuffer | BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) | AudioConverterChain::RenderOutput(CABufferList*, unsigned long, unsigned long&, AudioStreamPacketDescription*) | BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) | CBRConverter::RenderOutput(CABufferList*, unsigned long, unsigned long&, AudioStreamPacketDescription*) | BufferedAudioConverter::GetInputBytes(unsigned long, unsigned long&, CABufferList const*&) | CABufferList::AllocateBuffers(unsigned long) | operator new[](unsigned long) | operator new(unsigned long) | malloc | malloc_zone_malloc 
FREE  0x6c67000-0x6c67fff [size=4096]: thread_b0763000 |thread_start | _pthread_start | FetchAudio | ExtAudioFileRead | ExtAudioFile::Read(unsigned long, unsigned long&, AudioBufferList*) | AudioConverterFillComplexBuffer | BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) | AudioConverterChain::RenderOutput(CABufferList*, unsigned long, unsigned long&, AudioStreamPacketDescription*) | BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) | CBRConverter::RenderOutput(CABufferList*, unsigned long, unsigned long&, AudioStreamPacketDescription*) | BufferedAudioConverter::GetInputBytes(unsigned long, unsigned long&, CABufferList const*&) | free 
ALLOC 0x6c67000-0x6c67fff [size=4096]: thread_b0a6f000 |thread_start | _pthread_start | FetchAudio | ExtAudioFileRead | ExtAudioFile::Read(unsigned long, unsigned long&, AudioBufferList*) | AudioConverterFillComplexBuffer | BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) | AudioConverterChain::RenderOutput(CABufferList*, unsigned long, unsigned long&, AudioStreamPacketDescription*) | BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) | CBRConverter::RenderOutput(CABufferList*, unsigned long, unsigned long&, AudioStreamPacketDescription*) | BufferedAudioConverter::GetInputBytes(unsigned long, unsigned long&, CABufferList const*&) | CABufferList::AllocateBuffers(unsigned long) | operator new[](unsigned long) | operator new(unsigned long) | malloc | malloc_zone_malloc 
FREE  0x6c67000-0x6c67fff [size=4096]: thread_b0a6f000 |thread_start | _pthread_start | FetchAudio | ExtAudioFileRead | ExtAudioFile::Read(unsigned long, unsigned long&, AudioBufferList*) | AudioConverterFillComplexBuffer | BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) | AudioConverterChain::RenderOutput(CABufferList*, unsigned long, unsigned long&, AudioStreamPacketDescription*) | BufferedAudioConverter::FillBuffer(unsigned long&, AudioBufferList&, AudioStreamPacketDescription*) | CBRConverter::RenderOutput(CABufferList*, unsigned long, unsigned long&, AudioStreamPacketDescription*) | BufferedAudioConverter::GetInputBytes(unsigned long, unsigned long&, CABufferList const*&) | free 
ALLOC 0x6c67000-0x6c67fff [size=4096]: thread_b0081000 |thread_start | _pthread_start | __NSThread__main__ | -[NSThread main] | -[FirstViewController checkstate:] | CALayer_setter_kCAValueFloat | CALayer_setter | CA::Transaction::ensure_compat() | CA::Transaction::create() | malloc | malloc_zone_malloc 
FREE  0x6c67000-0x6c67fff [size=4096]: thread_b0081000 |thread_start | _pthread_start | __NSThread__main__ | -[NSString compare:options:] | _pthread_exit | _pthread_tsd_cleanup | free 
                'seemed to perform quicker' - unless you're creating threads very rapidly, I very much doubt that the method used to create your threads will affect their performance. However, please prove me wrong with some benchmarks ;)
– deanWombourne
                Oct 12, 2011 at 16:08
                how quick would you consider rapid? I'm detaching about 16 - 24 threads a second. Is that excessive?
– dubbeat
                Oct 12, 2011 at 17:20
                I'd consider that a bit excessive, yea. I would consider rethinking the architecture - with that many threads the cost of creating the threads will start to outweigh the benefit of them. Is there anything that you can do sequentially so you have far fewer threads being created?
– deanWombourne
                Oct 12, 2011 at 23:52
                Your opinion is appreciated. Well I have between 0 & 20 audio files that will need to be read from at any one time. Prehaps I could try and use just 1 single producer thread and service them from that. My worry is that it wont execute quickly enough. Or prehaps I could just have a thread constantly running for each bit of audio and use flags to signal if they should sleep or fetch audio? Do you think having this many threads could have anything to do with my memory access problem?
– dubbeat
                Oct 13, 2011 at 8:22
bufferList = (AudioBufferList *) malloc (
                                         sizeof (AudioBufferList) + sizeof (AudioBuffer) * (1)
// initialize the mNumberBuffers member
bufferList->mNumberBuffers = 2;

You are malloc'ing an AudioBufferList to have the capacity of one AudioBuffer, but then indicating that it actually has two. Try changing that "* (1)" to "* (2)".

In addition to this, you shouldn't perform malloc's or ExtAudioFileOpen's in the thread, as those will take up time. If you can manage to pre-perform the malloc's and ExtAudioFileOpen's and just keep them in a struct array for your files, you may find a increase in performance / stability.

I may not have read the code completely properly as it looks like the formatting got a little messed up, but I hope this helps.

You fix this by locating it and figuring out why it is wrong, not by a try/catch.

Guard Malloc can help you identify many issues in your program. It is a diagnostic option which you can enable in Xcode. The intent of the option is to fail when you attempt to read or write memory you do not own, making it clearer than usual which part of your program is causing issues. full details: man guardmalloc. The first step is to correct all issues guardmalloc points out. You should be able to run your app for hours without these issues.

If you want exceptions and runtime checks to help you identify these issues earlier on (which is worth your consideration), consider C++ rather than C for your implementations.

Update

if it's a heap allocation that is the allocation in question, then malloc logging will likely help you. when malloc logging is enabled and the debugger pauses execution, just use malloc_history to view the callstack for the allocation. malloc_history will lookup the address in the log and dump the callstack of the alloc's creation. from there, you just follow the allocation's flow through your program to find what you are getting wrong.

I'm having trouble using the information provided by malloc. A memory address is provided showing me where a malloc occurred. (Not sure if this is related to the exc_bad_access). Ive put in a break point and looked at the memory address of all the objects in the debugger but I can never find the object matching the address in the error. – dubbeat Oct 25, 2011 at 8:43 I get this message "malloc:recording malloc stacks to disk using standard recorder." Where can I view what has been recorded? – dubbeat Oct 25, 2011 at 10:00 @dubbeat man malloc sec. ENVIRONMENT. you can peek if you are curious, but it's easier to have a program (such as malloc_history) use it. – justin Oct 25, 2011 at 10:04

I eventually found the solution to this problem. Every time I needed audio I created a new thread to fetch the audio. On occassion while a thread was fetching audio for a particular the buffer the same buffer would request data again resulting in the same buffer be accessed at the same time, thus the exc_bad_access.

I solved this by having just one thread waiting and being signalled to get data using posix condition.

All of the answers here were useful and have helped me learn a lot about debugging. Thanks guys..

excellent that's great you got it sorted! I was going to look at this as soon as I got a spare moment. That said I probably wouldn't have been much help as I thought it was most likely a buffer size calculation issue. – Max MacLeod Oct 28, 2011 at 16:35 Good news. I suggest you mark your answer as accepted, so it doesn't continue to appear in unanswered lists... :) – Duncan Babbage Oct 30, 2011 at 18:55

The problem is almost certainly happening because your reading memory that you shouldn't be. Hence the EXC_BAD_ACCESS. What's essential is that the sizes of your buffers, and the amount of memory that you are reading is all correct. For example if you try to read more than a buffer's worth, you'll receive an error.

In ExtAudioFileRead, the value at &readoutpt2 should specify the number of frames. Are you sure this value is correct? Is bufferList big enough to store that number of frames? Are you advancing a pointer through bufferList as you read data, and is the amount you advance correct?

Are you correctly allocating memory based upon the underlying type? For example is your audio data integer or floating point format?

Basically, everything needs to add up correctly otherwise you will blow a buffer somewhere!

One other tool to try for tracking down memory issues is guard malloc. You can find more info here Enabling the Malloc Debugging Features

what format are the samples? ints or floats? what are your calculations for the buffer allocations? how many channels? – Max MacLeod Oct 12, 2011 at 15:47 the samples are signed 16 bit integers, 2 channels of audio. As a best guess would you say the problem is related to the bufferlist and not the actual audio read from disk? If I'm accessing 8 audio sources simultaneouly all is fine. Anymore than that and I get the error. Is it possible that due to lack of resources code in the thread isnt fully exectuted eg: creation of buffers – dubbeat Oct 12, 2011 at 17:24 I'd say it's more likely related to the buffers. How big are they and how did you calculate their size? – Max MacLeod Oct 13, 2011 at 10:18 the maximum size for each buff is 25600 samples * 4 bytes. I've included the full function in the post. Might be easier to look at rather than trying to explain. – dubbeat Oct 13, 2011 at 11:00

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.