Help with Timer-related GUI memory issue


#1

Hey all,

Working on a plug-in and I’m adding basic meters (Sample peak and RMS) to the GUI. I’ve perused the other forum topics I could find but am still having an issue of increased memory usage over time / memory leak.

What I’m doing is using non-enabled sliders as meters, polling data from a timer.

  1. The peak and rms levels are set in the process block.
  2. I use MyProcessor& getProcessor().getPeak() to set the slider’s value

It’s pretty straight forward and seems similar to what other people are using. Any initial thoughts as to what I’m doing wrong? Given that it’s been plaguing me for a full day now I’m sure it’s something simple :slight_smile:

Thanks!


#2

Update: I just tested a method of updating a slider’s value based on a timer every 100 ms, but this time with random values (so I’m not polling from the processor) and it is still having the same issue. Hmm.


#3

A bit more digging - I’ve tried using an custom class of AudioProcessorParameter to house the peak and RMS levels and still I have this issue.

Why would updating a slider’s value in the timer callback cause constantly increasing memory usage? I’ve determined it’s not happening if I remove the setValue line of code.


#4

You don’t seem to be asking the important question, which is what objects are leaking?

Until you work that out, you can’t fix a leak. JUCE has its own leak detector macro which you can add to your classes, and all major IDEs have instrumenting and profiling tools that’ll help track down memory leaks - use those to find the type that’s leaking and the cause should be simple to find.


#5

Thanks for the reply Jules - it was actually just what I needed. For anyone overwriting LookAndFeel classes with custom font, make sure your overhead isn’t massive by only creating that font from Binary Data once!