Introduction:

Replication agent is running more than 50 then replication behavior will not proper. We had observed that following error getting for event viewer.

 Application popup: distrib.exe - Application Error : The application failed to initialize properly (0xc0000142).

Setup a multi-tier replication topology so that each distributor has no more than 75-100 replication agents running on each physical host.

The main system replicates out to three or four subscribers which each publish there local copy and serve as there own distributor. These middle layer machines then replicate out to a set of 50 subscribers thereby limiting the number of replication agents which need to run on each machine.

There is unexpected behavior for replication process. Refer link where already problem shown :- Out-of-process replication agents may have problems.

The non-interactive desktop heap may run out of memory if many processes are created. When there is not sufficient memory to satisfy an allocation request, an error is returned and the user is notified that the computer is low on memory. Some programs may not handle the failure, and sometimes there may not be sufficient memory to create the error message dialog box. When there is not sufficient memory to create the error message dialog box, the requested operation may fail without generating an error message.

Registry Setting:

If there replication error occurred having of article explain there some registry setting.

One more note on this. After working with the Windows Engineers it was the registry key discussed earlier but set differently than anticipated. The following setting resolved our issue, and we have a significant number of distrib.exe's 

HKLM\System\CurrentControlSet\Control\SessionManager\Subsystems 

Open the Windows value 

Change the 3rd SharedSection value to 2048

After registry setting, you need to restart server before changing registry need to take backup.

Suggested reading: