Is There a Memory Leak in Microsoft Dynamics CRM 2011?
When we installed the Microsoft Dynamics CRM 2011 email router on a virtual machine we noticed Svchost (Service host) was slowly growing in memory, which led us to the following question.
How do we nail down the memory leak?
How can you figure out what service is causing memory growth in the svchost process? There are so many! Furthermore what can be done to stop the growth?
Background to the issue
As previously mentioned while working with the email router on a Windows Server 2008 R2 Virtual Machine we noted the svchost service was slowly increasing in memory.
The machine had 8 GB of RAM and after two days of running the svchost process would utilize over 7 GB and the server would become unresponsive.
The task was to identify and fix the issue and I thought it might be helpful to identify the steps.
Extra reading on the topic
For those of you who are not familiar with svchost a quick web search will tell you: that svchost is a generic name for services that run from DLLs (Dynamic-Link Libraries). More over the svchost process allows the execution of services from DLLs.
How the issue was solved
Using the process monitor to see the memory usage
1) Open your process monitor on the server (right click on the task bar and left click on task manager, then click on process manager).
- Unfortunately, you will see there are many instances of svchosts running simultaneously on your server (see the diagram below). This behaviour is by design so the failure of one service will not result in the failure of all the services failing under the svchost process. There are however some instances where by the svchost process will house several services, this is done to preserve system resources.

2) The next step in the investigation is to see what service or services are causing the SVC host process to grow. In the processes portion of the task manager click on the memory column to sort by memory usage, scroll to the top and you will see the offending svchost with its high memory usage.
3) At this point make note of its program ID, you will need it in step 7.
We have now know the Program ID of the svchost that is leaking memory, we now have to find the service within the hostfile that is creating the leak
Using the tasklist to show the services running under each process
4) Now open cmd
5) Type tasklist /svc > c:tasks.txt
In the command:
- ”tasklist” just displays a list of current processes on your machine
- “/svc” displays the services hosted in each process
- “c:” is the drive letter or path to the file you are storing the results of your command
- “tasks.txt” is the file name you are storing the results of your command

6) Now locate the text file you created and open it in notepad, in the above example it was c:tasks.txt
7) Search for the program ID you made note of in step 3

8) To the right of the program ID you searched for under services you will see a list of services using the svchosts that is causing you growth in memory usage.
9) In our case it was the winhttpautoproxy service that was causing the memory leak. When we disabled the service the problem went away.
I trust that helps you. In our case it was urgent that we found the memory leak. If you have any questions around the solution feel free to contact us.
Calculated Fields and Rollup Fields in Dynamics 365 CRM Solutions
In this recorded webinar, we'll cover how to create Rollup Fields and Calculated Fields to help you you automatically determine values based on other fields and records in the system.
January 30
9:00 am – 9:30 am PST