Amit said:
I am facing memory problem in my project . i am usin Static variables.
i want to know till when they remain in memory ?
The objects referred to by the variables will remain in memory until
they are garbage collected at the same time as the Class the variable
belongs to, and the class' ClassLoader. For various reasons that might
not happen, or perhaps may have to wait for a SoftReference to be cleared.
In general it is best not to use *non-final* static variables at all.
Also final statics to mutable structures are also bad. Although they
appear to offer cheap fixes, they make keeping code reliable unfeasibly
difficult.
Tom Hawtin