.NET MVC memory profiling questions
I am doing some research on the memory usage of ASP.NET MVC web applications. For my research i am using Windows Server 2008 R2 with IIS 6.1 and SQL Server 2008 R2 in Virtualbox 4.1. I chose to use a virtual server because it was not an option to test on the live server. For profiling i am using ANTS Memory Profiler 7.0. In the beginning i was wondering why even the most simple websites already use up to ~30 - 40mb.
As an example i am using the 'My MVC Application' website, which is the tutorial website in Visual Studio, but the same concept applies to all websites i profiled. When i run ants profiler in the website in idle state, i get the following summary:
Generation 1: 26kb
Generation 2: 2100kb
Large object heap: 240kb
Unused memory allocated to .NET: 3265kb
Unmanaged: 20890kb
Also, there are 7000 string objects, which make up ~600k in total in memory in idle mode. Where do all these strings come from? I hope you can give me some info on these questions.
If you're using ANTS Memory Profiler 7, use the Instance Categorizer on, for example, the string instances to carve them up and work out where they originate from. It's particularly useful in situations like this where you've got thousands of instances, and you want to work out where they are coming from. Strings need this sort of analysis very often.
精彩评论