Intermittent plugin segfaults and crashes only on Mac

I have a number of VST plugins I’ve developed and tested on Windows/Visual Studio which I’m now trying to build/use on Mac/XCode.

I’m having 2 problems:

  1. Intermittent Segfaults: When I build on Mac in XCode, some of the plugins fail intermittently to build due to segmentation faults.
    Additional information
  • If I rebuild repeatedly, eventually the build will pass without segfault
  • When I comment ALL of the code from each function in the plugin (simply returning kResultOk from each), I would expect the segfault to go away, but I still get the same error - How could this make sense?
  1. Intermittent Host Crashing: When I do successfully build the plugins which are having segfaults, They dont seem to operate as they should, and they often crash the host DAW (Ableton)… Im guessing this is connected to the above described segfaults, and even though I got around the segfault (somehow), there are still problems.

Does anyone know of issues that would cause these segfaults/crashes in Mac but not Windows? Its particularly odd that removing the body of every function in the plugin doesnt get rid of the segfault…

The only change I made when migrating from Windows to Mac was to update the Info.plist file to have “Bundle Identifier” = com.steinberg.vst3., and “Executable File” = .

Thanks!

Can you build with the Address Sanitizer and see whether it blows up?

If it crashes even when your functions do nothing, then a few things could be the cause:

  1. It’s running a different version of the code than you think
  2. You’re running with an incompatible compiler runtime/version
  3. There’s a bug in the plugin validator tool,
  4. There’s a bug in the support library / glue you link in
  5. There’s some kind of hardware problem on your system (bad RAM, disk, etc.)
  6. There’s some bug related to lifetime in your plugin – use after free, improper delete versus delete, and so forth

You’ll need to change one of these things at a time to try to debug what the problem can be.
Also, when you get a segfault, check what the different registers point at, and what’s on the stack, to see what kind of data/buffer is being processed, to get a clue as to where the problem might be.