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

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:

enter image description here

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

1 Answer

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:

enter image description here


Long story:

  • google'd "diagnostic policy service" site:reddit.com
  • found a reddit thread talking about the "SRUDB.dat" file getting too big
  • they pointed at a microsoft thread
  • inside of the microsoft thread they also talk about the SRUDB.dat file getting too big
  • i went to my machine's C:\Windows\System32\sru directory
  • there were 22,000 + files
  • the SRUDB.dat was 4.5GB
  • i tried to create a zip file of the directory but could not because it was open by the running process
  • i tried manually stopping the service with services.msc but the process auto-restarts
  • go back to the microsoft thread
  • there is a batch script that sets the service to not-auto-start (aka "manual") then kills the process here is the batch *1
  • then deletes the directory
  • then starts the service again
  • i reviewed all the code in the batch script then ran the batch script with admin privilege

*1 here's the low level steps of the script:

  • calls sc. set the service "DPS" to "demand" (aka "manual")
  • calls sc to get the "DPS" process id number (PID)
  • calls taskkill to stop the PID
  • calls rd to delete the src directory
  • calls sc to change the "DPS" service to "auto"
  • calls sc to start "DPS" service

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like