static variables

  • Thread starter Thread starter Venue
  • Start date Start date
V

Venue

Is there any disadvantage in using lot of static variables in an application
(apart from I guess slow load of app). Mostly I want to use it to keep the
values (many of them) to be resused all through the lifecycle of app.
 
Not really. Static variable provide the benefit that they don't invoke the
garbage collector since they neve get released, but having too many
(megabytes worth) will result in less memory for the rest of the system and
then more garbage collection. If you're talking about a bunch of strings and
numbers and a few classes or graphics objects, you should be just fine.
 
Back
Top