How do you fix the Microsoft Service "Diagnostic Policy Service" taking up about 4GB memory and about 1 cpu core at 100%?

Tre*_*ith 5 memory cpu-usage windows-services memory-leaks windows-10

How do you fix the Microsoft "Diagnostic Policy Service" taking up about 4GB memory and about 1 cpu core at 100%?

I found out there is a process that keeps using up tons of CPU because my computer fans keep spinning up for heat. But the problem is that the cpu/memory usage wasn't always bad. And when you restart the process it SEEMS to go away for a while.

I used a python program psrecord to measure the cpu usage and memory usage of the process (and children) to find out that this process takes about 12 hours to get to maximum memory usage and it has lots of CPU usage:

在此输入图像描述

The first graph is:

  • x-axis time in seconds
  • y-axis cpu usage in percent (100% is one full core)

The second graph is memory usage:

  • x-axis is time in days
  • y-axis is memory usage in MB

Tre*_*ith 6

In a nutshell: You have to stop the process, delete the directory C:\Windows\System32\sru that is used by the process, start the process back up. Once I did this the service now uses about 20 MB memory and 0% CPU.

Here's a quick screenshot of the memory usage going down:

在此输入图像描述


Long story:

*1 这是脚本的低级步骤:

  • 来电sc。将服务“DPS”设置为“需求”(又名“手动”)
  • 调用sc以获取“DPS”进程 ID 号 (PID)
  • 调用taskkill停止 PID
  • 调用rd删除 src 目录
  • 要求sc将“DPS”服务更改为“自动”
  • 调用sc启动“DPS”服务