lichtungsgnarr / controlp5

Automatically exported from code.google.com/p/controlp5
0 stars 0 forks source link

Memory problem. #62

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm setting the text of a textlabel in draw method and the memory be increasing 
infinitally, why this ocurred, how I can resolve 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").setFont(ControlP5.grixel);
        txtLabel = (Textlabel) cp5.getController("txtLabel");
    }

    public void draw() {
        txtLabel.setText("draw");

        Runtime.getRuntime().gc();
    }
}

note see the memory in activity monitor.

Original issue reported on code.google.com by ademar.a...@jurema.la on 20 Sep 2012 at 11:04

GoogleCodeExporter commented 9 years ago
bitfonts with controlp5 are written into PImages when text changes or is set, I 
have seen reports t hat suggest that there might be memory leaks with PImages. 
To circumvent this behavior, consider to use a PFont instead of a bitfont by 
using
cp5.setFont(createFont("",10)); 

after you initialized controlp5.

Original comment by soj...@gmail.com on 22 Sep 2012 at 10:23