BUG: Memory Leak in Client Process When You Use UDP for DCOM Protocol (294710)



The information in this article applies to:

  • Microsoft COM, when used with:
    • the operating system: Microsoft Windows NT 4.0

This article was previously published under Q294710

SYMPTOMS

If a Distributed Component Object Model (DCOM) client process that uses User Datagram Protocol (UDP) creates a large number of COM objects on the remote computer or makes a lot of calls to methods that return interface pointers as parameters, you may see a consistent increase in the private bytes of this DCOM client process. When interface pointers are marshaled, the object identifier (OID) and interface pointer identifier (IPID) are cached by the client process. When there are many activations and method calls, this cache continues to grow when you use the UDP DCOM protocol.

If the DCOM server does not return a new interface to its clients every time (which occurs with a singleton, an object pooling, or an object reuse scenario), this problem may not occur because the OID and IPIDs are reused.

RESOLUTION

To work around this problem, use TCP/IP instead of UDP for the DCOM protocol. To add Connection-oriented TCP/IP to the list of default protocols, follow these steps:
  1. Start Dcomcnfg.exe.
  2. On the Default Protocols tab, search for the Connection-oriented TCP/IP option in the DCOM Protocols list. If this option is not present, click Add. In the Protocol Sequence list, click Connection-Oriented TCP/IP, and then click OK.
  3. If Connection-oriented TCP/IP does not appear first in the DCOM Protocols list, click Connection-oriented TCP/IP, and then click Move Up.
  4. Restart the computer for these changes to take effect.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

The following scenario is one scenario that may reproduce the problem.

A DCOM client process that uses UDP creates a COM object on a remote computer, calls a simple method on it, and releases the proxy. This call sequence is wrapped in a loop that is similar to the following code:
for (;;)
{
     CoCreateInstance (CLSID_TestServ, NULL, CLSCTX_REMOTE_SERVER, IID_TestServ, &pTestServ);
     pTestServ->Call();
     pTestServ->Release();
}
				
After you allow this DCOM client process to run for some time, you can see a consistent increase in the Private Bytes of the DCOM client process.

Modification Type:MajorLast Reviewed:10/23/2003
Keywords:kbbug kbDCOM kbnofix KB294710