When Is The Object Eligible For Garbage Collection?

后端 未结 7 651
后悔当初
后悔当初 2020-11-27 07:22

In the code below, given that amethod has been called. At what point/line is the Object originally referenced by myObject, eligible for Garbage Col

7条回答
  •  遥遥无期
    2020-11-27 08:19

    Since you are holding myObject in classObject(reference is maintained), it(object in memory referenced through classObject) will not be available for Garbage collection until instance of Test is freed up/unloaded.

提交回复
热议问题