Microsoft Knowledge Base Email Alertz

(324399) - Fixes the problem that occurs when a worker thread in the client calls a Visual Basic ActiveX DLL. Explains that the hotfix is available on the Microsoft Web site. Explains the workaround where you remove the global reference of the XML DomDocument.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 324399 - Last Review: November 15, 2007 - Revision: 3.2

FIX: Memory leak may occur when a worker thread from a client calls a Visual Basic ActiveX DLL

Hotfix download is availableHotfix Download Available
View and request hotfix downloads
This article was previously published under Q324399

On This Page

SYMPTOMS

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.

RESOLUTION

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:
http://support.microsoft.com/contactus/?ws=support (http://support.microsoft.com/contactus/?ws=support)
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

WORKAROUND

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.

STATUS

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).

MORE INFORMATION

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

  1. Start Visual Basic 6.0.
  2. 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.
  3. 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
  4. On the Project menu, click References.
  5. In the References - Project1 dialog box, click Microsoft XML, v2.6 reference, and then click OK.
  6. On the File menu, click Make Project1.dll.
  7. Call the Test function in the Project1.dll file from a worker thread of a client application.

REFERENCES

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

APPLIES TO
  • Microsoft XML Core Services 4.0
  • Microsoft XML Parser 3.0
  • Microsoft XML Parser 2.6
  • Microsoft XML Parser 2.5
  • Microsoft XML Parser 2.0
Keywords: 
kbautohotfix kbhotfixserver kbqfe kbdll kbxml kbbug kbfix KB324399
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate