Memory Leak: JuceAU::SaveState & Ableton Live 8 (Latest JUCE tip)


#1

Hey Jules,

I have discovered amemory leak with the latest JUCE tip inside of juce_AU_wrapper.mm which only seems to be triggered in Ableton Live 8. Further more, this memory leak was not present in any version of Logic or AU Lab (both 32-bit and 64-bit -- tested w/ Logic Pro 9 and Logic Pro X) and the VST wrapper seemed to handle as expected.

Anyways, I am using Mountain Lion 10.8.5 12F37 with Xcode 4.6.3 (4H1503) and I have setup the build configuration with MacOSX 10.8 as the base SDK and GNU++98 as the dialect.

One more thing to note, is that there are no issues with the VST wrapper in the same version of Ableton Live 8.4.1

From Apple Instruments, here is the call stack as recorded by the leak detector:

   0 CoreFoundation __CFAllocatorSystemAllocate
   1 CoreFoundation CFAllocatorAllocate
   2 CoreFoundation _CFRuntimeCreateInstance
   3 CoreFoundation __CFDataInit
   4 CoreFoundation CFDataCreate
   5 AudioUnitProject JuceAU::SaveState(void const**) /Users/joeburnett/AudioUnitProject/Builds/MacOSX/../../JuceLibraryCode/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm:377
   6 AudioUnitProject AUBase::DispatchGetProperty(unsigned long, unsigned long, unsigned long, void*) /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUBase.cpp:556
   7 AudioUnitProject AUBase::ComponentEntryDispatch(ComponentParameters*, AUBase*) /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/AUDispatch.cpp:219
   8 AudioUnitProject AUMIDIEffectBase::ComponentEntryDispatch(ComponentParameters*, AUMIDIEffectBase*) /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/OtherBases/AUMIDIEffectBase.cpp:135
   9 AudioUnitProject ComponentEntryPoint<JuceAU>::Dispatch(ComponentParameters*, JuceAU*) /Applications/Xcode.app/Contents/Developer/Extras/CoreAudio/AudioUnits/AUPublic/AUBase/ComponentBase.h:135
  10 AudioUnitProject AudioUnitProjectAUEntry /Users/joeburnett/AudioUnitProject/Builds/MacOSX/../../JuceLibraryCode/modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm:1519
  11 CarbonCore CallComponent
  12 CarbonCore CallComponentDispatch
  13 AudioToolbox _AT_AudioUnitGetProperty

 


#2

If you look at the juce code, you can see that it does correctly release that CFData block - it's the host that's doing the leaking there, not the plugin.