Microsoft KB Archive/194707

{|
 * width="100%"|

FIX: Thread Local Storage Leak Under Internet Explorer 3.0x

 * }

Q194707

-

The information in this article applies to:


 * Microsoft Internet Explorer (Programming) versions 3.0, 3.01, 3.02

-

SYMPTOMS
Repeated loading and unloading of the Wininet.dll library from a single process will eventually fail. After approximately 63 loading and unloading of the library, the process will no longer be able to load the Wininet.dll library.

This problem can also be seen with COM objects linked statically to Wininet.dll. If within a single process, the COM object is instatiated and destroyed many times, eventually the CoCreateInstance call to the COM object will fail.

CAUSE
Wininet.dll library requires the use of a Thread Local Storage when loaded. However, when a FreeLibrary call is made, the Wininet.dll fails to release the TLS it used. Consequently, the process will eventually run out of TLSs causing any future LoadLibrary calls to fail.

RESOLUTION
At this time, there are two workarounds:


 * Upgrade the system to Internet Explorer 4.x. Internet Explorer 4.x's Wininet.dll does not exhibit this behavior.
 * Avoid dynamically loading and unloading the Wininet.dll from your process.

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug was corrected in Microsoft Internet Explorer 5.

Steps to Reproduce Behavior
Building and running the following piece of code under a system using Internet Explorer 3.0x will demonstrate this bug:

#include 
 * 1) include 

int main {  HINSTANCE hInst; int counter = 0;

while (1) {     if (!(hInst = LoadLibrary ("wininet.dll"))) {        printf("LoadLibrary failed : %d \t Counter : %d\r\n",            GetLastError, counter); break; }

if (!FreeLibrary (hInst)) {        printf("FreeLibrary failed : %d \t Counter : %d\r\n",            GetLastError, counter); break; }

counter++; }

return 0;

} Additional query words:

Keywords : kbIE300bug kbIE301bug kbIE302bug kbie500fix

Issue type : kbbug

Technology : kbIEsearch kbAudDeveloper kbSDKIESearch kbSDKIE300 kbSDKIE301 kbSDKIE302