I want to destroy static object programmatically. Is it possible? If yes then how can i achieve this. Kindly suggest.
The thing that you need to understand is - the references are static, the objects aren't. By that, I mean to say, in
static SomeClass someClassInstance = new SomeClassInstance();
the static property is on the reference someClassInstance
and GC acts on instances / objects.
someClassInstance =null
will make the first SomeClassInstance eligible for GC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With