lowleveldesign/process-governor

--maxjobmem seems to have no effect (on MsEdge)

Closed this issue · 5 comments

Hi, I'd like to limit the combined memory for all processes of a Windows task with the --maxjobmem arg. For testing I've tried to limit the Edge browser's memory consumption.

Neither using procgov --maxjobmem with the PID of Edge's root process nor starting a new Edge process seemed to have any visible effect.

Command I ran:

procgov -r --maxjobmem 500M "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" 

I've also set the recursive flag under the assumption that it's needed to capture the spawned child processes.

If I'm using this wrong, any right example would be appreciated :-)

Related #29

Hi, if you want to automatically add newly created child processes to the job, the -r option is the right choice.

I tried starting Edge with the --maxjobmem option. Below, I paste a screenshot from Process Explorer:

image

You can see that the job contains all the child processes, and it has the committed memory limit set to 500M. Internally, procgov uses the JobMemoryLimit field to establish this limit. Unfortunately, it is pretty hard to verify that this memory limit works, as neither Process Explorer nor Process Hacker provides a counter for total committed memory. You may then observe Private Bytes - it should not extend 500M for all the processes within a job.

@DominikMe have you tried again? Did it work?

@lowleveldesign I just tried and this time I couldn't see Edge's process tree surpass the job limit, not sure what happened last time. I've also validated with Process Explorer and it shows the job limit.

Setting the limit too low will make Edge unstable and crash but that's not your tools fault :-)

Thanks for the quick response, I'm closing the issue and will think more how I can use this.

I think I found what confused me last time. Closing Edge's main window doesn't necessarily kill all Edge processes. Running the procgov command to launch Edge will fail to capture the processes inside its job while an Edge process is still running as the msedge.exe seems to be reusing those.

Ah, I see, and I know the problem. It's the startup boost that keeps Edge instances alive:

image

I hit this issue on several occasions. Thanks for the message, and I am happy to hear that procgov worked in the end.