In the process of trying to slim down ChartPT‘s memory usage, I settled on these free tools:
Skip the many tutorials out there for the command line “vadump.exe” and use VMMap instead. The GUI presents information in a much more useful format (filterable, sortable).
First, check the list of loaded modules – some are explicit References in your project, others are dependencies of your references – and eliminate dependencies that you can do without.Â Next, check the “Private” and “Private Working Set” columns to identify areas that you may have some control over.
Be sure to grab the “2.0” flavor of the profiler.Â Many tutorials are old and link to the CLR 1 version of the .Net Profiler – that version won’t work with your app that builds against .Net 2.0 or newer.
Use this app to take a snapshot of your memory usage, then view allocations by object type and view allocations in a call graph.
My biggest culprit: WCF
System.ServiceModel and System.Web grab 5.5MB of private memory (14+MB of private WS on my machine) as soon as I instantiate a client proxy object.Â The same things happens using built-in HTTP bindings in a skeleton console app or in the WCF test client.Â The System.Web allocation could probably be eliminated by changing to TcpTransport.