Garbage collection of global Application object in ASP.NET MVC C#

185 views Asked by At

I have ran into a problem where a long running singleton added to HttpApplicationState which does some data masking (GDPR), stops masking data after running in the background for some time.

It's hard to debug because it only happens in our UAT enviroment and it usually happens overnight.

The problem is that the data masking library is third party, and is still work in progress (or at the end of that work in progress).

But I'd appreciate if anyone with better GC knowledge could look at the init code below, and confirm this is out of GC domain.

The Translator.GetInstance() is a Lazy loader of the GDPR masking/translation singleton. So it's initialized the first time the user masks/unmasks the data.

protected void Application_Start()
{
    if (Translator)
    {
       Application["MaskDataUtility"] = new MaskDataUtility(Translator.GetInstance());
    }
    else
    {
       Application["MaskDataUtility"] = new MaskDataUtility(new CustomTranslator());
    }
}
0

There are 0 answers