Microsoft KB Archive/295432

= BUG: DHTML Edit Control Leaks Memory =

Article ID: 295432

Article Last Modified on 5/11/2006

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 3
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 4
 * Microsoft Visual Basic 6.0 Enterprise Edition Service Pack 5

-



This article was previously published under Q295432



SYMPTOMS
When you repeatedly load and unload a form that contains a Dynamic HTML (DHTML) Edit control from Internet Explorer 5.5 Service Pack 1 (SP1), you may encounter a memory leak. This problem occurs with DHTML Edit control (Dhtmled.ocx) version 6.1.0.8852.



RESOLUTION
To work around this problem, use Hide and Show methods on the form instead of the Unload and Load methods.



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.



Steps to Reproduce Behavior
 Create a new standard EXE project in Visual Basic. Form1 is created by default. Add a command button (Command1) to Form1.  Add the following code to Form1: Private Sub Form_Load Command1.Caption = &quot;Load Form2&quot; End Sub

Private Sub Command1_Click Form2.Show End Sub  In the Components dialog box, add DHTML Edit control for IE5 to your project. Add a new (Form2) to your project, and add a command button (Command1) to Form2. Add a DHTML Edit Control to Form2.</li>  Add the following code to Form2: Private Sub Form_Load Command1.Caption = &quot;Unload the form&quot; End Sub

Private Sub Command1_Click Unload Me   'WORKAROUND: Uncomment the next line to use the Hide method instead. 'Me.Hide End Sub </li> Run the project. Load and unload Form2 repeatedly. In Performance Monitor or Task Manager, notice that a memory leak has occurred.</li></ol>

<div class="references_section">