Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does view.remove remove it from the memory?

Tags:

android

I am wondering if parent.removeView(child) actually removes child from the memory.

Or is it just the linkage between the parent and the child that is removed?

If the latter is correct, is there any way to remove the child view for the sake of memory allocation?

like image 924
Moon Avatar asked Jul 06 '26 21:07

Moon


1 Answers

parent.removeView(child) actually removes the View from the View hierarchy, in other words removing the linkage between the parent and child.

Although memory allocation is handled by the virtual machine it self. If you have reference to the child you can make it null yourself. Doing this will make sure that when the garbage collector is called next time, your child object will be garbage collected.

like image 83
Eric B. Avatar answered Jul 08 '26 11:07

Eric B.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!