Processes started by the service cannot allocate memory

I have a C # service running as a LocalSystem account that starts many other processes depending on their needs. This happens within a few months. This week, some of the subprocesses are crumbling. I connected a remote debugger to them, and they do not allocate memory (the new C ++ operator returns 0x0), which is an indirect cause of the failure.

It's funny if I RDP into the machine, I can easily start the process from CMD without any problems. However, when the service starts it, do not leave.

The device is running Windows XP SP3. It is not an obligation to fix about 80% of physical memory.

Are there any special restrictions on how many processes or how much memory can be used by a service, including processes spawned by this service?

Any other ideas why these processes cannot allocate memory.

EDIT:

I had a good look at the SysInternals Procmon crash scenario and it doesn't reveal anything (what I see). Everything looks normal and then suddenly crashes. I can confirm that I connected a remote debugger that it crashes after dereferencing the null pointer from a new C ++ call. This is one of the first objects highlighted in the application; it should never fail.

I also found that if you enable the Enable services option: allow services to interact with the desktop, then all child processes start correctly. However, they appear on the desktop when connected via RDP and, unfortunately, terminate if you exit through RDP = YUK! However, this is not an ideal solution - I would really like to know why the child processes could not allocate memory after the 6th child process.

+2
windows memory windows-xp service
source share
3 answers

I hope this answer helps someone in the future ... I had the same problem: the applications would work fine if the windows were allowed to render, but if they failed, they would start when they started, if they started under the service and did not allowed to interact with the desktop. The solution is to increase the size of the non-integrated heap of Windows stations in the registry, which was installed at 512 KB on my machine, and a bunch of computers with the operating system - 3072 KB.

You can change this by selecting

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

Value is a long string. You need to change the SharedSection parameter, which looks something like this:

SharedSection = 1024.3072.512

The second number is the size of the heap of the interactive window stations, and the last is the size of the non-integrated heap of Windows stations. If you delete the last number, then the interactive and non-interactive heaps of stations will have the same size. This is what I did.

Read more here: http://support.microsoft.com/kb/184802

+5
source share

Are there any special restrictions on how many processes or how much memory can be used by a service, including processes spawned by this service?

Job objects can be used to limit memory usage by a process (or group of processes), but something would have to relate the processes in question to this job object.

There is no such job object for service processes.

Think about how to use the registry so that you can debug the launch of running processes: http://msdn.microsoft.com/en-us/library/a329t4ed.aspx

+1
source share

You may find SysInterals Procmon useful for viewing what happens to your processes.

+1
source share

All Articles