• 弱引用weak reference,表示可有可无, gc扫描到随时回收
    • WeakReference weakRef = new WeakReference(s)
  • 只要GC就回收,用做容器如WeakHashMap(key是弱引用), ThreadLocalMap的key
  • WeakReference<M> m = new WeakReference<>(new M());
    System.gc();
    m.get();