Possible allocation in VST3 processCallback

operator new(unsigned __int64 size) Line 78	C++
juce::ThreadLocalValue<bool>::get() Line 111	C++
juce::ThreadLocalValue<bool>::operator=(const bool & newValue) Line 88	C++
juce::ScopedThreadLocalBooleanSetter::ScopedThreadLocalBooleanSetter(juce::ThreadLocalValue<bool> & ref) Line 272	C++
juce::JuceVST3Component::processParameterChanges(Steinberg::Vst::IParameterChanges & paramChanges) Line 3090	C++
juce::JuceVST3Component::process(Steinberg::Vst::ProcessData & data) Line 3152	C++

The initialisation of ScopedThreadLocalBoolean causes an allocation

3 Likes

Thank you for reporting this. This should be fixed by 7c68dd37 on develop.

2 Likes

Thank you!

I found this because I overwrote the new & delete operator with a routine which checks if the calling thread is the current audio callback-thread.

I would likely do the same with malloc, but it seems there is no solution to do this with c++.

It would be great if HeapBlock would have some kind of hook (global function pointer?) which can be overridden to perform such a check every time malloc is called (only for debugging reasons).

1 Like

We do such checks by using the platform specific malloc hook facilities, every allocation triggered by new or malloc can be found this way. But it’s not portable. On macOS, you can inject your own malloc handler to the malloc zone returned by malloc_default_zone, on Windows there is _CrtSetAllocHook.

Sidenote: This won’t work for a plugin loaded in Logic

2 Likes

Perfect, your advice helped me a lot!

What a great idea! + JUCE feature request :slight_smile: