Article ID: 183364 - Last Review: July 22, 2003 - Revision: 1.1 FIX: Memory Leak Using UDP Socket Under Windows CE 2.0This article was previously published under Q183364 On This PageSYMPTOMS
Under Windows CE, a memory leak exists when you use a UDP (datagram)
socket. The leak occurs when you call either the send() or sendto() API on
either a connected or unconnected socket, respectively. A call causes a
small leak in the kernel. Eventually, the handheld PC runs low on memory,
which triggers message boxes detailing the error. As a result, other
applications might terminate due to insufficient memory.
CAUSE
A kernel critical section object in the route cache of the IP layer. Calls
to send/sendto on UDP sockets cause a leak per call.
RESOLUTION
There are no hot fixes available. The only viable solution is to avoid
using datagram sockets and use stream sockets instead.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. This problem was corrected Windows
CE, version 2.1.
MORE INFORMATIONSteps to Reproduce BehaviorTo reproduce the problem put the following code into a file and compile it using the winsock.lib. This sample code creates a datagram socket and sends out 1 byte of data on each call to the sendto() API.Sample Code | Article Translations
|

Back to the top
