I’m have a problem with memory using processing and controlP5, if I use this code:
public class LabelTeste extends PApplet {
private static final long serialVersionUID = 1L;
private ControlP5 cp5;
Textlabel txtLabel;
public void setup() {
size(600, 600);
noStroke();
cp5 = new ControlP5(this);
cp5.addTextlabel("txtLabel").setText("Setup");
txtLabel = (Textlabel) cp5.getController("txtLabel");
}
public void draw() {
txtLabel.setText("draw");
}
}
the memory usage goes up astronomically… somebody know why and how to concert this?
controlP5 uses a bitfont by default to render text. when text is updated (for example with setText()), a new PImage will be created into which text is then rendered and displayed. I have seen people reporting memory leaks with PImage but cant confirm but only supect. An alternative to the default bitfont rendering of text with controlP5 is to use processing PFont instead. Use: