| Author |
static variable memory allocation
|
vijaya bharath
Ranch Hand
Joined: Jun 10, 2005
Posts: 66
|
|
Hi, I have a doubt. Memory for static variable will be allotted at compile time. What if i write a class with 50000 static variables and compile that and never use that class. What about the memory allotted.Is it waste of memory?
|
Regards,<br />Vijaya Bharath.<br />SCJP1.4 <br />SCWCD5.0
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
|
The memory will be allotted when the class is *loaded* at runtime. A class that doesn't get used doesn't get loaded, so no, it wouldn't have any effect on memory consumption.
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
vijaya bharath
Ranch Hand
Joined: Jun 10, 2005
Posts: 66
|
|
|
Thanks for your reply
|
 |
 |
|
|
subject: static variable memory allocation
|
|
|