3 ms·
You can with the JVM. https://docs.oracle.com/javase/9/docs/api/java/lang/ref/Cleaner.html https://docs.oracle.com/javase/9/docs/api/java/lang/ref/Clea... How
by cogman10 4y ago
You can with the JVM.
https://docs.oracle.com/javase/9/docs/api/java/lang/ref/Cleaner.html https://docs.oracle.com/javase/9/docs/api/java/lang/ref/Clea...
However, the issue isn't so much that doing that, rather it's that GC will potentially never collect the memory. In the JVM, the GC primarily runs when enough allocations happen. It's not on some timer.
So the concern would then be having a password sitting in memory for hours (or even days) on end.