setText in Label and memory usage


#1

Hello,
I’ve got a memory problem when displaying a fader value in a Label or in a TextEditor (I tried both with the same result) :
They are setup like this in the component constructor :

addAndMakeVisible(contSlider = new Slider(String(identifier+1))); 
  contSlider->setSliderStyle(Rotary);
  contSlider->setTextBoxStyle(NoTextBox, true, 0, 0);
  contSlider->setRange (0.0, 1.0, 0.001);
  contSlider->addListener(this); 
  contSlider->addListener(mainListener); 

addAndMakeVisible(contLabel = new Label());

and the Label (or TextEditor) text is updated like that (in the same component) :

void Controller::sliderValueChanged(Slider* slider){
  contLabel->setText(String(contSlider->getValue()), false);
};

I’m a C++ noob so I’m not very confident to how a debuger works especially when I have to use it with a dll, but a try with visual leak detector gave me a frightening 988 memory leaks detected and when I check the memory usage in the Task Manager it increases at something like 1Mo every 5"… except if I stop trying to update my label, and just comment the line above, the memory remains then stable… What Am I doing wrong?
All the best,
Matthieu
EDIT: I forgot to mention that if I use :

It works fine too but I’m wondering why my first tries lead to that result…