Processes launched by a service can't allocate memory

佐手、 提交于 2019-12-06 13:46:08
Andreja Zitnik

I hope this answer will help somebody in the future... I had the same problem - apps would run fine if windows were allowed to render, but would crash on startup if ran under a service and not allowed to interact with desktop. The solution lies in increasing the size of non-interactive windows station heap in the registry, which was set to 512KB on my machine while interactive windows station heap was 3072KB.

You can change this by going to

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\SubSystems\Windows

The value is a long string. You need to change the SharedSection setting which looks something like this:

SharedSection=1024,3072,512

The second number is size of interactive windows station heap and the last one is size of non-interactive windows station heap. If you delete the last number then interactive and non-interactive windows station heaps will be of the same size. That's what I did.

Read the details here: http://support.microsoft.com/kb/184802

Are there some special limitations of how many processes or how much memory can be used by a service, including processes spawned by that service??

Job objects can be used to restrict the memory usage of a process (or group of processes), but something would need to associate the processes in question with that job object.

There is no such job object for service processes.

Consider using the registry to allow you to debug from the start-up of the affected processes: http://msdn.microsoft.com/en-us/library/a329t4ed.aspx

You might find SysInterals Procmon useful for seeing what's going on with your processes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!