Microsoft KB Archive/322980

= INFO: Winsock User-Mode Dump Heap Logs and Handle-To-Pointer Translation Table Memory Usage =

Article ID: 322980

Article Last Modified on 12/1/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition
 * Microsoft Platform Software Development Kit-January 2000 Edition
 * Microsoft Windows XP Professional
 * Microsoft Windows XP Professional x64 Edition
 * Microsoft Windows XP Driver Development Kit
 * Microsoft Windows XP Embedded

-



This article was previously published under Q322980



SUMMARY
After all socket objects are closed and while the program is still running, the user-mode dump heap (UMDH) tool may still report memory increase.

The memory allocations that are described in this article are because of creation or expansion of the Winsock Handle-To-Pointer Translation Table.

These memory allocations are not memory leaks and you can safely ignore them.



MORE INFORMATION
Winsock runtime internally maintains the Handle-To-Pointer Translation Table to manage socket objects. The table grows to handle all sockets that are being used by a program. The growth of the table is proportional to the maximum number of sockets that are open in the application at any specified time.

After the table expands, it does not shrink even when sockets are closed. The allocations can be reused for other sockets. They are freed only when either WSACleanup is called or the process is ended.

This behavior is by design.

For example, memory can be allocated in the following circumstances:

  When the table is initially created: +    416 (    416 -     0)      1 allocs       BackTrace00204 +      1 (      1 -     0)     BackTrace00204  allocations

ntdll!RtlDebugAllocateHeap+000000FD ntdll!RtlAllocateHeapSlowly+0000005A ntdll!RtlAllocateHeap+000008C2 KERNEL32!GlobalAlloc+00000082 WS2HELP!WahCreateHandleContextTable+00000059 msafd!SockInitialize+000000EC ntdll!LdrpCallInitRoutine+00000014 ntdll!LdrpRunInitializeRoutines+000001DF ntdll!LdrpLoadDll+000002DD ntdll!LdrLoadDll+00000017 KERNEL32!LoadLibraryExA+0000001D WS2_32!DPROVIDER::Initialize+000000E6   When a socket is created: +    944 (    944 -     0)      6 allocs       BackTrace00230 +      6 (      6 -     0)     BackTrace00230  allocations

ntdll!RtlDebugAllocateHeap+000000FD ntdll!RtlAllocateHeapSlowly+0000005A ntdll!RtlAllocateHeap+000008C2 KERNEL32!GlobalAlloc+00000082 WS2HELP!WahInsertHandleContext+00000160 msafd!WSPSocket+00000500 WS2_32!WSASocketW+000000EA WS2_32!socket+00000054 client!??? @ 00401AC2 client!??? @ 00403188       KERNEL32!BaseThreadStart+00000052

+    912 (    912 -     0)      6 allocs       BackTrace00232 +      6 (      6 -     0)     BackTrace00232  allocations

ntdll!RtlDebugAllocateHeap+000000FD ntdll!RtlAllocateHeapSlowly+0000005A

ntdll!RtlAllocateHeap+000008C2 KERNEL32!GlobalAlloc+00000082 WS2HELP!WahInsertHandleContext+00000160 WS2_32!DSOCKET::AssociateSocketHandle+00000022 msafd!WSPSocket+00000541 WS2_32!WSASocketW+000000EA WS2_32!socket+00000054 client!??? @ 00401AC2 client!??? @ 00403188       KERNEL32!BaseThreadStart+00000052   When a socket connection is accepted: +    152 (    304 -   152)      2 allocs       BackTrace00178 +      1 (      2 -     1)     BackTrace00178  allocations

ntdll!RtlDebugAllocateHeap+000000FD ntdll!RtlAllocateHeapSlowly+0000005A ntdll!RtlAllocateHeap+000008C2 KERNEL32!GlobalAlloc+00000082 WS2HELP!WahInsertHandleContext+00000160 msafd!WSPSocket+00000500 msafd!WSPAccept+000008FE WS2_32!WSAAccept+00000072 WS2_32!accept+00000015 server!mainCRTStartup+000000C5 KERNEL32!BaseProcessStart+0000003D

+    152 (    304 -   152)      2 allocs       BackTrace00180 +      1 (      2 -     1)     BackTrace00180  allocations

ntdll!RtlDebugAllocateHeap+000000FD ntdll!RtlAllocateHeapSlowly+0000005A ntdll!RtlAllocateHeap+000008C2 KERNEL32!GlobalAlloc+00000082 WS2HELP!WahInsertHandleContext+00000160 WS2_32!DSOCKET::AssociateSocketHandle+00000022 msafd!WSPSocket+00000541 msafd!WSPAccept+000008FE WS2_32!WSAAccept+00000072 WS2_32!accept+00000015 server!mainCRTStartup+000000C5 KERNEL32!BaseProcessStart+0000003D 

