I created a class (assuming the Tree). Then I initialize an instance:
Tree a = new Tree()
Now I want to delete instance a and free memory allocated for it. How I can do? I hope you help me solve this problem. Thank you very much!
I created a class (assuming the Tree). Then I initialize an instance:
Tree a = new Tree()
Now I want to delete instance a and free memory allocated for it. How I can do? I hope you help me solve this problem. Thank you very much!
You should dereference the object.then automatically during garbage collection memory will be deallocated. Dereferenceing can be done by Tree a = null;
I think that assigning a null value to an instance of a class will empty it, deleting any memory for it. Previous code:
Tree a;
a = new Tree();
New code:
Tree a;
a = new Tree();
//Empty out Tree 'a'
a = null;