Helo, i want to exit second window of the PApplet and create another, but i want to clear it absolutely from RAM, becouse its getting takes a lot of RAM, the value getting only higher… how to delete PApplet in all ?
PWindow win;
public void settings() {
size(300, 300);
}
void setup() {
win = new PWindow();
PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, win);
surface.setLocation(20, 20);
}
void draw() {
background(255, 0, 0);
fill(255);
rect(10, 10, frameCount, 10);
}
void mousePressed() {
println("mousePressed in primary window");
win = new PWindow();
PApplet.runSketch(new String[] {this.getClass().getSimpleName()}, win);
}
class PWindow extends PApplet {
void settings() {
size(1920, 1028);
}
void setup() {
background(150);
}
void draw() {
ellipse(random(width), random(height), random(50), random(50));
}
void mousePressed() {
println("mousePressed in secondary window");
exit();
}
void exit() {
dispose();
surface.setVisible(false);
System.gc();
}
}