I am new to Java and I am developing a Minesweeper clone using a MVC architecture. I it is much easier to restart the game creating a new view like this:
model.restart();
view = new View (model);
Than coding a view.restart()
method.
My view class it inherits from the JFrame
Swing component.
The problem is, that after playing the game for a while, I get java.lang.OutOfMemoryError: unable to create new native thread
.
I have tried calling the garbage collector to delete old views with System.gc
, but it doesn't work, and maybe makes the problem to appear sooner.
Thank you for your help! Greetings from Spain!