Exported VST3 crashes Ableton if compiler optimizations are turned on

Hi, I’m new to using compilers (other than just the basic compilation of code) so I assume there’s something obvious I’m missing here. I’m compiling a VST3 plugin in Xcode. I wanted to experiment with compiler optimization levels to get an idea of how they impact the performance of my plugin. I’ve tried many permutations of optimization levels across the project and build targets and toggled between debug and release. What I’ve found is that, no matter what, if any amount of compiler optimization is triggered in the build process, my plugin crashes Ableton immediately when it is loaded. The DAW’s crash log spits out:

Thread 0 Crashed
MyAudioProcessor::prepareToPlay(double, int) + 2520
juce::JuceVST3Component::setActive(unsigned char) + 769

I’ve also built for release using the default settings which puts release optimization level at Fastest [-O3] in the Apple Clang - Code Generation. This configuration still crashes Ableton.

So as far as I know, I’ve built for release using all the default settings and still crash. Is there some setting I’m missing that would resolve this? Or is this possibly some OS specific issue? (I know OS Catalina and DAW’s have had a lot of compatibility issues)

Thanks!

When something works in Debug, but crashes in Release, it usually means that something is wrong with the code itself. Maybe there is some uninitialized (member) variable or some mandatory check that is only executed in Debug.

Based on the stack trace, the crash happens in MyAudioProcessor::prepareToPlay. What did you write in that function?

1 Like

Awesome that was it. I disabled some components and now it runs both in debug and release with optimizations turned on. Thanks dude. I should be able to track it down from here now that I know what the root cause is.