Your right, this is about security. I have a password that is in a String. The String is created with new, so it is an object. The String is global, so it is on the heap. Once the class the String is in goes out of scope, the String is eligible for gc. I was wondering if the password text would be erased in memory when it is gc.
My questions are:
Using the Sun 5.0 JVM, will this String be erased when it is gc, like with the generation and compacting algorithms which I believe are default gc for that JVM?
How often will the gc run? The class I have the password doesnt last long, so I believe this is sent to the youth generation gc.