A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Joined: Sep 14, 2001
Feb 04, 2003 01:33:00
When are static variables eligible to garbage collection?
Joined: Nov 22, 2008
Feb 04, 2003 04:23:00
Static variables are garbage collected when the class they belong to is garbage collected. Classes can only be collected when nothing refers to that class anymore.
Joined: Apr 05, 2000
Feb 04, 2003 07:05:00
If the static variable is being used by a number of objects then it is eligible for GC when the last object using it is GC'd.
The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
I agree. Here's the link:
subject: Static variable
object creation and garbage collection
Brogden's Garbage Collection?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015