HEAP CORRUPTION DETECTED [Help]

Hi, I’m working on a synth and i have a problem when creating multiple std::vectors<ModuleGui * > where ModuleGui is a class i created.
if I do something like this I don’t get any type of error
"
private:

Fm_synthAudioProcessor& processor;
std::vector<ModuleGui*> modules;

"

but if I declare 2 vectors
"
private:

Fm_synthAudioProcessor& processor;
std::vector<ModuleGui*> modules;
std::vector<ModuleGui*> modules2;

"
I get an HEAP CORRUPTION DETECTED
even if modules2 is just declared.
Capture

Looks like there’s an issue somewhere else in your code that happens to manifest when you add this line of code.

I suggest using Address Sanitizer (ASAN) and Undefined Behaviour Sanitizer (UBSAN) to figure out what exactly is wrong with your code.

This article should help you get started:

1 Like

Thank you so much! I’ll check it out