Graphics::drawText and Font::getStringWidth leaking?


#1

I’m getting leaks from repeated calling of Graphics::drawText and Font::getStringWidth. The leaks add up and are problematic because I wan’t to draw resized/repositioned text whenever my Component’s window is resized. Code examples and more details are in my reply to: https://forum.juce.com/t/juce-graphics-command-line-leak/12903/6

I just wanted to start a new thread on this because the leak issue turned out to be different than the other thread’s, and I didn’t find anybody else posting about the same problem. Thanks for the input!


#2

Well I am thoroughly confused now… To clarify I’m on a Mac and I identified these “leaks” by seeing the memory usage climb in Xcode’s debugging tool which also reports the same figure as the Activity Monitor shows. However I also tried running my JUCE app with the Leaks profiling template in the Instruments tool and cannot see any leaking alerts regarding the code in question.

I guess my question now is what is the most reliable way to identify leaks in C/C++ code on the Mac? I’m aware of JUCE’s leak detection macros which I’m not hitting. Does increasing memory usage as reported in the Activity Monitor and Xcode’s debugger not necessarily imply a memory leak?

I also see climbing memory usage when continually resizing an AudioProcessorEditor with a ResizableCornerComponent as implemented in the JuceDemoPlugin… surely that can’t be a leak?


#3

I guess other people found the memory usage as reported by the Xcode debugger to be untrustworthy: http://stackoverflow.com/questions/28321954/ios-memory-usage-increasing-cant-find-the-culprit/28566113#28566113 It sounds like Instruments reports trustworthy numbers though. I’ll presume that my code in question is not leaking after all. Hopefully this can prevent wasting someone else’s time down the road!