Garbage collection of Composed Objects

前端 未结 5 2279
青春惊慌失措
青春惊慌失措 2021-01-05 11:10

I have two classes

Class A
{
    //constructor
}

Class B
{
    private A a;

    public B()
    {
        a = new A();
    }
}

Suppose I u

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-05 11:27

    There are also some flags you can use when running a Java program (at least with the Sun JVM) that will give some debugging information about what goes on during garbage collection. Try the -verbose:gc option.

    http://download.oracle.com/javase/6/docs/technotes/tools/solaris/java.html

提交回复
热议问题