Greetings,
I'm experiencing very curious crashing problem with one of my projects. I seem to lack the required understanding to resolve this issue.
The crash is happening when I EXIT the host running this specific dll. The crash frequency is about 33% of all exits.
The error message says:
Faulting application name: reaper.exe, version: 5.4.0.0, time stamp: 0x58d4503b
Faulting module name: ntdll.dll, version: 6.1.7601.18247, time stamp: 0x521ea8e7
Exception code: 0xc0000005
Fault offset: 0x0003332f
I have seen these Reaper exit & ntdll.dll crashes quite a lot with other vst plugins too. So in this light I was wondering if this issue is with Reaper, instead of my project.
However, when I debug the crash with VS, it points to IPlugVST.cpp line 366:
case effClose:
{
lock.Destroy();
DELETE_NULL(_this);
return 0; <<--------------- Stopped at exception
}
I have checked and re-checked and yet again checked that ALL objects I create with "new" are being deleted properly. So I don't think this is the cause.
To make thing even more bizarre, I noticed that this crash might have interaction with arrays I'm using. There are about 12 small arrays in this particular project (acting as delay lines). When I completely remove them, the exit crash seems to go away.
BUT ALSO: When I INCREASE the size of each array to something like 20000 each (instead of default 1000), the crashing seems to go away too!!???
I have tested arrays on heap, arrays on stack and vectors. They all behave the exact same way with this issue.
Code:
class StaticDelay
{
public:
StaticDelay() {}
~StaticDelay() {}
void Init(int length_spl) {
length = std::min(length_spl, 1000);
sindex = 0;
};
double Process(double input) {
sloop[sindex] = input;
sindex >= length ? sindex = 0 : sindex++;
return sloop[sindex];
};
private:
int sindex = 0, length = 0;
double sloop[1000] = {};
};
In the end I'm not even sure the arrays are the cause of this. I'm using the same methods with my other projects too, and they have not been crashing this way. Only this particular project.
So, I'm open to suggestions if possible how to try to resolve this issue?
Thanks for reading!