I tried to use some sanitizers but they seemed unavailable for my system. I am on MSYS2 with GCC 9.
What about gdb?
Is it possible to use gdb as a sanitizer or something? gdb usually works great for me but the backtraces and random crashes make me think it's actually some kind of memory corruption.
If Valgrind supports your platform, or if you can also build for a supported platform, then that will likely help you find your crash.
Yeah it doesn't. I mean there is an old version that supposedly works with mingw but it seems outdated and I couldn't get it to build.
Windows has something resembling ASAN, you could try running your application with some/all checks enabled.