I actually have a quick question which I cannot find an answer to.
I am VERY persistant that my Android/Java application eats up the least amount of RAM as possible as it helps the user experience.
With that being said my question is focused on field variables and the garbage collector.
My application will start up and I have a list of set field variables (hardcoded). Now for the sake of readability I have chosen field variables. If I wish to make a quick change I change the value instead of me looking through my code to see when the variable is actually used.
My field variables in this case are only used ONCE, when the application is loaded for the first time.
Does the garbage collector remove this variable or must I set it null manually. I know a simple int value isn't much to cry over, however I am curious as to the garbage collector.
The object which contains the field will always be in use (it will be an Android ViewPagerAdapter in this case).
Copyright License:
Author:「basickarl」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/19507217/java-garbage-collector-and-field-variables