Memory leak occurs when behaviors are dynamically removed (309170)



The information in this article applies to:

  • Microsoft Internet Explorer version 6 for Windows 2000
  • Microsoft Internet Explorer version 6 for Windows XP
  • Microsoft Internet Explorer version 6 for Windows 98 Second Edition
  • Microsoft Internet Explorer version 6 for Windows NT 4.0
  • Microsoft Internet Explorer version 6 for Windows 98

This article was previously published under Q309170
IMPORTANT: This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry, click the following article number to view the article in the Microsoft Knowledge Base:

256986 Description of the Microsoft Windows Registry

SYMPTOMS

Memory is not deallocated when an attached or element behavior is dynamically added and then removed in an HTML page.

CAUSE

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

RESOLUTION

To resolve this problem, obtain the latest service pack for Internet Explorer 6. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

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: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

This fix is included in Internet Explorer 6 SP1, but it is turned off by default. To turn this fix on, set the following registry value to either a string value of "yes" or a binary value of 1:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Cleanup HTCs

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

315014 BUG: Memory Leak Occurs When You Remove Behaviors

For this fix to take effect, the code must meet these 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.

Modification Type:MinorLast Reviewed:9/23/2005
Keywords:kbHotfixServer kbQFE kbenv kbIE600preSP1fix kbprb kbQFE kbIE600sp1fix KB309170