1
class SimpleObject{
    NormalObject obj1;
    NestedCustomObject obj2;
    List<Obj extends Timer> threadObj1;
    List<Obj extends Thread> threadObj2;
}

Such Thread obj is running on.

How to release an obj manually like that (SimpleObject obj)?

Will System.gc() release it automaticly if obj=null?

More Detail

After assign null value to the object and call System.gc(), program suspend on the thread again whill debuging

it seems that thread obj will not be release automatically.

suiwenfeng
  • 1,865
  • 1
  • 25
  • 32

1 Answers1

0

System.gc() is a hint to JVM , JVM may chose to ignore it. There are no way to force garbage collection.

Ramanlfc
  • 8,283
  • 1
  • 18
  • 24