Reducing the memory usage on startup

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
7 years ago
Thank you for the tips.  I have a client running on version 3.7.  I will give this a try.
7 years ago
Sergei-k wrote:
Thank you for the detailed analysis and a full description of this issue. I did the code analysis  and made all the necessary changes, you can view them here. If you ll have time please test the changes and write then wheter all problems are solved.


@Sergei-k - why not add BowscapXmlHelper to the autofac container as a singleinstance instead of managing via the singleton wrapper with locks?

DependencyRegistrar.cs

//user agent helper
            builder.RegisterType<UserAgentHelper>().As<IUserAgentHelper>().InstancePerLifetimeScope();        
            builder.RegisterType<BrowscapXmlHelper>().WithParameter("filePath", CommonHelper.MapPath(config.UserAgentStringsPath)).SingleInstance();


This will lose the ability to start up if the filepath doesn't exist but I personally would want immediate notification if that configuration was invalid, if others need it to still run, could just add checks in browscapXmlHelper.cs for initialization.
7 years ago
beyondfantasy wrote:

@Sergei-k - why not add BowscapXmlHelper to the autofac container as a singleinstance instead of managing via the singleton wrapper with locks?

DependencyRegistrar.cs

//user agent helper
            builder.RegisterType<UserAgentHelper>().As<IUserAgentHelper>().InstancePerLifetimeScope();        
            builder.RegisterType<BrowscapXmlHelper>().WithParameter("filePath", CommonHelper.MapPath(config.UserAgentStringsPath)).SingleInstance();


This will lose the ability to start up if the filepath doesn't exist but I personally would want immediate notification if that configuration was invalid, if others need it to still run, could just add checks in browscapXmlHelper.cs for initialization.


Hello. Lock and the singleton approach is a good implementation, fast and reliable. Registering object in autofac container that will be used in one place only seems  unnecessary to me.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.