Got doubts with respect to C# static/const member/local variables. Just want to know what happens to the memory allocated to unused static/const member/local variables in C#, how is the memory reclaimed in the following example scenario?
Question is about memory behavior with respect to static and const variables [considering per-App-Domain piece of memory - static storage]? This question is NOT about Garbage Collection. It is about memory and what happens to unused static and const variables that (also) have memory?
Spaghetti Code Snippet:
/// <summary>
/// Skew your data with every-second-and-annoyed updates
/// </summary>
class Skewgle
{
static Skewgle cloneApele = new Skewgle();
const Skewgle patentMoto = default(dynamic);
static int? dontBeEvilMotto = 1998;
const int ditchMotoToBeEvil = 2014;
static void Main()
{
const Skewgle findYourMailsAlreadyReadBetweenSpamTabs = patentMoto;
if (findYourMailsAlreadyReadBetweenSpamTabs == null)
{
System.Console.WriteLine("findYourMailsAlreadyReadBetweenSpamTabs and patentMoto are null");
}
if (cloneApele != null)
{
System.Console.WriteLine("cloneApele is not null");
}
System.Console.WriteLine("What about dontBeEvilMotto? ditchMotoToBeEvil?");
}
}
Thanks