One thing you can verify is if your plaintext password is supported by the library by adding a weak link to it and see how long it takes to leave. You can check if it helps to collect a certain amount of garbage from time to time. But avoid doing forced GC in production code, especially on servers.
But this is only half the problem: it mostly depends on what other libraries do with your string. If they insert a password in some other line and store it with a link, it will be insecure in memory if you do not control it.
user180326
source
share