Groups | Blog | Home
all groups > dotnet clr > july 2003 >

dotnet clr : Does static members consume more memory?



Célio Cidral Junior
7/24/2003 9:09:48 AM
Hello!

I am a newbie in CLR. Somebody said to me that static members consume more
memory than instance members because they stay in memory along all the
application's lifetime. Is that true? What are the technical details about
that?

Thank you in advance.


--
Celio Cidral Junior
WEG Industries
Jaragua do Sul - SC - Brazil
ccidral@expresso.com.br

Jon Skeet
7/24/2003 1:38:40 PM
[quoted text, click to view]

Static members stay in memory until the AppDomain they're in is
unloaded, yes. As to whether that means they "consume more memory" or
not, it's such an imprecisely worded statement that it could be argued
either way.

Personally, I wouldn't worry about the memory side too much until you
have reason to - design for whatever's most natural.

--
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet/
AddThis Social Bookmark Button