Hi @adamwilson … I know this was a long time ago, but do you recall what it was that was actually causing the memory issue? It seems like simply making an AudioProcessor
a member shouldn’t cause this kind of problem.
We’re getting a similar thing. Simply creating an AudioProcessor
instance and allowing it to be destroyed causes memory corruption.
It doesn’t matter whether it’s allocated on the stack or heap, or which thread it’s created on.
Our application makes extensive use of other JUCE code including hosting plugins, and is working fine. It’s just AudioProcessor
that seems to have the issue.
We get something like:
022-05-06 18:10:59.603537+0100 Lightworks[87841:1009683] ==87841==ERROR: AddressSanitizer: attempting free on address which was not malloc()-ed: 0x000157178858 in thread T8
#0 0x11081805d in wrap__ZdlPv+0x7d (libclang_rt.asan_osx_dynamic.dylib:x86_64h+0x5505d)
#1 0x10ff6a234 in std::__1::_DeallocateCaller::__do_call(void*) new:334
#2 0x10ff6a218 in std::__1::_DeallocateCaller::__do_deallocate_handle_size(void*, unsigned long) new:292
#3 0x156dc1c80 in std::__1::_DeallocateCaller::__do_deallocate_handle_size_align(void*, unsigned long, unsigned long) new:262
#4 0x156dc1c54 in std::__1::__libcpp_deallocate(void*, unsigned long, unsigned long) new:340
#5 0x156e2342d in std::__1::allocator<std::__1::__hash_node<juce::String, void*> >::deallocate(std::__1::__hash_node<juce::String, void*>*, unsigned long) memory:1673
#6 0x156e23374 in std::__1::allocator_traits<std::__1::allocator<std::__1::__hash_node<juce::String, void*> > >::deallocate(std::__1::allocator<std::__1::__hash_node<juce::String, void*> >&, std::__1::__hash_node<juce::String, void*>*, unsigned long) memory:1408
#7 0x156e23264 in std::__1::__hash_table<juce::String, std::__1::hash<juce::String>, std::__1::equal_to<juce::String>, std::__1::allocator<juce::String> >::__deallocate_node(std::__1::__hash_node_base<std::__1::__hash_node<juce::String, void*>*>*) __hash_table:1603
#8 0x156e231c1 in std::__1::__hash_table<juce::String, std::__1::hash<juce::String>, std::__1::equal_to<juce::String>, std::__1::allocator<juce::String> >::~__hash_table() __hash_table:1541
#9 0x156e23184 in std::__1::__hash_table<juce::String, std::__1::hash<juce::String>, std::__1::equal_to<juce::String>, std::__1::allocator<juce::String> >::~__hash_table() __hash_table:1533
#10 0x156e23164 in std::__1::unordered_set<juce::String, std::__1::hash<juce::String>, std::__1::equal_to<juce::String>, std::__1::allocator<juce::String> >::~unordered_set() unordered_set:495
#11 0x156d9ff14 in std::__1::unordered_set<juce::String, std::__1::hash<juce::String>, std::__1::equal_to<juce::String>, std::__1::allocator<juce::String> >::~unordered_set() unordered_set:493
#12 0x156da0118 in juce::AudioProcessor::~AudioProcessor() juce_AudioProcessor.cpp:65
#13 0x156a70bba in TestAudioProcessor::~TestAudioProcessor() Processor.cpp:79
This is from simply calling a function like:
void testCreate()
{
TestAudioProcessor proc;
}