0

I'm starting a project using the Aubio library within openFrameworks, so I'm copying in code to my project from Aubio demos, modifting, etc. The Aubio function new_aubio_pitchdetection() works great, but the similar function new_aubio_onset() doesn't. In fact, it gives me an EXC_BAD_ACCESS error in the freeImage library of all things-- which I'm not referencing at all, anywhere in my project. (FreeImage is built into openFrameworks, yes, but other than that I'm not going near it)

The error takes me to the file ofImage.cpp and says:

//this is for grayscale images they need to be paletted from: http://sourceforge.net/forum/message.php?msg_id=2856879

I'm familiar with EXC_BAD_ACCESS in a memory-management context, but this looks like maybe there's a namespace problem going on? I find it completely baffling to my little brain how this function can cause an error in such distant (and supposedly nonactive) code.

I can post code samples, of course, but this seems to be a problem on a more fundamental level than can be seen in a snippet.

buildsucceeded
  • 4,203
  • 4
  • 34
  • 72

1 Answers1

0

The code is most probably corrupting the heap. That can cause widespread problems, just about any code is using the heap. The code that fails is not responsible for the corruption. Diagnose this with a good debug allocator, see what's available in your CRT. Or a thorough code review.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • Yep, this is what it sounds like. My guess is that the working function is using memory blocks of one size, and the corrupting function uses ones of a different size-- but I'm passing in the same pointer to both. Thanks! – buildsucceeded May 14 '11 at 09:11
  • Okay, having taken out the offending line, now I only get the crash **sometimes**. More debugging to do. Any wisdom on what to look for? – buildsucceeded May 16 '11 at 13:52