Kaseya Community

How to prevent a process from hoarding memory

  • Simple question:

    A customer of ours is having some problems with one server. it runs a process (cqmghost.exe which is used by the HP management tools) which usually uses about 600MB's of RAM, however, every few weeks it suddenly starts hoarding memory, meaning it will consume up to 5 or 6 GB's of RAM, causing reduces SQL performance.

    Is there a way to monitor the memory usage of this process (which runs as a service) and restart the service when the RAM usage is over 1 GB?

  • You can use perfmon to do that. You can select the Process object, select one of the counters, and select cqmghost.exe as the instance.

  • BTW, the counter you want if you want to monitor memory usage as you see in the task manager is called Working Set - Private

  • Monitor Set CqMgHost.xml


    You will undoubtedly want to change the thresholds and do some testing before deploying in production, but these should get you started.  The first is the Monitor Set to watch the memory usage.  The second is the Agent Procedure to have that monitor set "trigger" when memory usage gets too high.  These are untested, just off the cuff, no warranty, etc... but should give you an idea of what to do and how to do it.  Without question, it would be preferable to do some improvement, like checking for the service existing before stop/starting it (in case the Agent Procedure gets deployed inappropriately) or something like that.  But, hopefully, this will get you started in the right direction :)


  • Procedure CqMgHost Service Restart.xml

    And here's the second one:

  • @Mbartels

    I didn't think of that one, thank you very much, this is the easiest way to monitor this and restart the program if needed!

    This has given us some air to find out whats causing the memory leaks.