.NET Framework using up memory


I recently got a question something similar to:


"We are having some memory issues when trying to run our .NET applications over Citrix. Since each user is running his or hers own session .NET Framework loads into memory for each instance of the application and this appears to hog the memory. Are there any recommendations when writing applications for these scenarios?"


Here is my response. I felt that this could be useful to lot many people:


The .net framework is loaded into a process for each application separately. The design does not allow sharing of the framework resources between processes. So if there are multiple processes running – there is going to be hit. However there are some practices that can help improve performance:



  1. Try and use Application Domains in the application – these will allow you to dynamically load dlls that are needed at a time into an application domain and when you are done – unload the application domain to conserve the resources.

  2. If the performance hit is substantial during the initial load of the application – try using NGEN to pre-jit the assemblies.

  3. I would recommend using a profiler (visual studio team system has one) to profile the applications and see what are the bottle necks – possibly minor tweaking in a few areas can give you significant improvement

  4. Possibly re-architect the application such that you have one server process that uses the framework and other parts of the application remain light weight and communicate with this server process – this is just a thought – it most likely is not going to be easy or feasible and would depend on the application and its functionality.


Comments (2)
  1. I recently got a question something similar to: "We are having some memory issues when trying to

Comments are closed.

Skip to main content