I'm writing a java applet with a reset button so that users can restart the app with a specified number of objects, and when the reset button is clicked, this method that I have defined gets called:
public void reload(int new_number){
init_num_objects = new_number;
this.destroy();
this.init();
}
This button technically does exactly what I want, it changes the value of a variable that init calls and restarts the applet:
public void init(){
load_objects(init_num_objects);
}
The problem is that the more and more the user clicks the reset button, the slower the program (and consequently the user's computer) become. It's as if the applet is reloading each time without clearing memory space from the previous process. Is there a way to make the program just completely close and restart without slowing the client machine down?