Newsgroups : Microsoft : microsoft.public.inetsdk.programming.wininet : 2006 Mar : WinINet APIs appear to be leaking handles

www.cryer.info
Managed Newsgroup Archive

WinINet APIs appear to be leaking handles

Subject:WinINet APIs appear to be leaking handles
Posted by:"coder1024" (coder10..@discussions.microsoft.com)
Date:Mon, 13 Mar 2006 04:41:27

My application is periodically (twice per minute) using HTTP to submit
information to a web server and to download information from it using the
WinINet APIs.

After running overnight, I noticed in Task Manager that the #of handles had
grown rather large.  Using WinDbg and the handle utility from the
sysinternals web site, I was able to discover that the handle growth was all
registry key handles and that it was the same key over and over (over a
thousand of these so far).  The key being leaked is shown below.

HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap

My sequence of calls is shown below.

InternetOpen <at initialization>

--- for each request ---
InternetCrackUrl
InternetConnect
InternetSetOption
HttpOpenRequest
HttpAddRequestHeaders
HttpSendRequest
HttpQueryInfo
InternetReadFile

InternetClose <at shutdown>

I've gone through my code and it appears I'm releasing any handle I'm given,
so it seems like the leak is internal.  Is there any workaround for this?

Replies:

www.cryer.info
Managed Newsgroup Archive