JVM about jvm memory and thread safety sample code for thread safety from soft leaks to garbage collection