I am supporting an application that has a known memory leak which the vendor is not anticipating fixing. The memory leak causes the dllhost.exe process to utilize large amounts of memory. When the memory utilization for this process approaches the 500,000KB range it cripples the app and requires a restart of IIS. I can prevent this by monitoring the dllhost.exe process and choosing to 'end process' when memory utilization for this process nears 500,000KB.
This is a completely manual process. Is there a way to automate this? I tried playing with IIS scheduling but restarting IIS brings down the site all together. Ending the process on dllhost.exe is much cleaner and it allows the users to continue to use the app. Any help you can provide would be greatly appreciated.
Ah, memories. This takes me back to 1999, when all Web applications work this way. Well, we both know that the "right" answer is to replace the application, but often the cost associated with upgrading an application is greater than the cost of implementing a hack work-around. So, let's explore the hack.
You don't mention what OS you're running, but I'll bet it's Windows 2000. I would suggest using the Performance Logs And Alerts snap-in in the Performance tool, and creating a creating an alert that is triggered when the memory used by the dllhost.exe process is greater than, say, 250,000KB. To do this, first use System Monitor to watch the Pool Paged Bytes, Virtual Bytes, and Working Set counters in the Process performance object for the dllhost instance. Pick whichever counter most obviously indicates an impending problem, and note the value when you want to kill the process.
Then, use the Performance Logs And Alerts snap-in (also available in the Performance console) to add an alert using the Process performance counter of your choice. Have the alert launch an executable or batch file that kills the process from the command-line, such as TSKILL. The command "TSKILL dllhost.exe" would do this. If you need to run a separate command to re-launch the application, put both TSKILL and this second command in a batch file, and call the batch file from the alert.