Hi, I was wondering how efficient the
java garbage collector was at cleaning up unlinked objects. If I have an object I reuse over and over again but just reinstantiate it with each round of the program's execution instead of resetting particular variables back to their initial value, does it make a large performance difference?
In other words, as a simple example:
1.
for (int nCounter = 0; nCounter < 10; nCounter++)
{
myObject1 = new myObject();
}
2.
for (int nCounter = 0; nCounter < 10; nCounter++)
{
myObject1.init()
}
Would 1. be a lot worse than 2.? The init() function would just rest all the variables to their initial values.