Article ID: 309170 - Last Review: January 31, 2007 - Revision: 5.11

Memory leak occurs when behaviors are dynamically removed

This article was previously published under Q309170
Important This article contains information about how to modify the registry. Make sure that you back up the registry before you modify it. Make sure that you know how to restore the registry if a problem occurs. For more information about how to back up, restore, and modify the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756  (http://support.microsoft.com/kb/322756/ ) How to back up and restore the registry in Windows
Expand all | Collapse all

SYMPTOMS

When an attached or element behavior is dynamically added and then removed in an HTML page, memory is not deallocated.

CAUSE

This problem is caused by a synchronization issue between Microsoft Internet Explorer and the script engine.

RESOLUTION

To resolve this problem, obtain the latest service pack for Internet Explorer 6. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
328548  (http://support.microsoft.com/kb/328548/ ) How to obtain the latest service pack for Internet Explorer 6
The English version of this fix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
   Date         Time   Version       Size       File name     
   -------------------------------------------------------
   01-May-2002  18:44  6.0.2717.100  2,752,512  Mshtml.dll
				

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Internet Explorer 6 Service Pack 1.

MORE INFORMATION

Warning Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.

This fix is included in Internet Explorer 6 SP1. However, by default, it is disable. To enable this fix, set the following registry value to a string value of "yes" or to a binary value of 1:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Cleanup HTCs
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
315014  (http://support.microsoft.com/kb/315014/ ) BUG: Memory leak occurs when you remove behaviors
For this fix to take effect, the code must meet the following requirements:
  • The behavior must have only one script element, and all script (such as inline event handlers) in the .htc file must use the same language as the single script element.
  • The script element can use the SRC attribute with no limit in the code size in the referenced file. However, the size of the script file referenced in the src attribute or the script code in the script tags must be at least 512 bytes.
This fix is only for lightweight HTML Components (HTCs). Support for regular HTCs would require architectural changes in both Mshtml and Jscript that were not feasible. Possible workarounds for regular HTCs include:
  • Make the HTC a lightweight HTC.
  • Navigate the page to reclaim memory.

APPLIES TO
  • Microsoft Internet Explorer 6.0, when used with:
    • Microsoft Windows XP Home Edition
    • Microsoft Windows XP Professional
    • Microsoft Windows XP Media Center Edition
    • Microsoft Windows XP Tablet PC Edition
    • Microsoft Windows 2000 Advanced Server
    • Microsoft Windows 2000 Datacenter Server
    • Microsoft Windows 2000 Professional Edition
    • Microsoft Windows 2000 Server
    • Microsoft Windows NT Server 4.0 Standard Edition
    • Microsoft Windows NT Server 4.0, Terminal Server Edition
    • Microsoft Windows NT Workstation 4.0 Developer Edition
    • Microsoft Windows 98 Second Edition
    • Microsoft Windows 98 Standard Edition
Keywords: 
kbhotfixserver kbenv kbie600presp1fix kbprb kbqfe kbie600sp1fix KB309170
 

Article Translations