A Microsoft Visual Basic ActiveX DLL has an apartment-threaded thread,
has the
Unattended Execution property set and the
Retained In Memory property set, and contains a global XML
DomDocument object. If the Visual Basic ActiveX DLL has a simple function that is named Test that returns a clone of
this global XML
DomDocument object, a memory handle leak or thread handle leak may occur when
the
Test function is called from a worker thread of a client application.
A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.
If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.
Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft Web site:
Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.
The English version of this hotfix has the file attributes (or later file attributes) 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 Platform
--------------------------------------------------------------------
14-Jun-2002 06:38 8.20.9814.0 1,120,768 msxml3.dll x86
To work around this problem, use one of the following methods:
- Remove the global reference of the XML DomDocument object from the Visual Basic ActiveX
DLL.
- Use Microsoft Visual C++ to create the ActiveX DLL instead of using Visual Basic to create a ActiveX DLL. There is no memory leak with
a Visual C++ ActiveX DLL.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.This problem is fixed in MSXML 3.0 Service Pack 3 (SP3).
This hotfix is also available in MSXML 3.0 Service Pack 3 (SP3). MSXML 3.0 SP3 is included with Microsoft Internet Explorer 6.01 and with Microsoft Windows XP SP1. This hotfix is not available as a separate Web release.
Steps to reproduce the behavior
- Start Visual Basic 6.0.
- On the New tab in the New Project dialog box, click ActiveX DLL, and then click Open.
Note By default the Class1.cls file is created. - Add the following code to the Class1.cls file:
Option Explicit
Public g_objTest As MSXML2.DOMDocument
Public Function Test() As MSXML2.DOMDocument
If (g_objTest Is Nothing) Then
Set g_objTest = New MSXML2.DOMDocument
If (g_objTest.Load(App.Path & "\xml\VBLeaks.xml") = False) Then
Call Err.Raise(5, "Test", g_objTest.parseError.reason)
End If
End If
Set Test = g_objTest.cloneNode(True)
End Function - On the Project menu, click References.
- In the References - Project1 dialog box, click Microsoft XML, v2.6 reference, and then click OK.
- On the File menu, click Make Project1.dll.
- Call the Test function in the Project1.dll file from a worker thread of a client application.
For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
170946Â
(http://kbalertz.com/Feedback.aspx?kbNumber=170946/
)
How to create and use a minimal ActiveX component in VB
824684Â
(http://kbalertz.com/Feedback.aspx?kbNumber=824684/
)
Description of the standard terminology that is used to describe Microsoft software updates