Select the product you need help with
FIX: OLE Automation BSTR caching will cause memory leak sources in Windows 2000Article ID: 139071 - View products that this article applies to. This article was previously published under Q139071 SUMMARYThis article describes the following about this hotfix release:
SYMPTOMS Automation (previously called OLE Automation and ActiveX Automation) caches the space allocated for BSTR strings.
This may cause IMallocSpy to attribute memory leaks to the wrong BSTR user in
an application that uses Automation's BSTR strings. The correct source of the leak can be found by disabling Automation's cache by setting the environment variable OANOCACHE=1 before running the application. In many server-based applications, the BSTR cache is not required. There is a hotfix available to disable BSTR caching on Windows 2000 computers. Windows XP and Windows Server 2003 do not require the hotfix to disable BSTR caching. 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. 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, submit a request to 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 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.
(http://support.microsoft.com/contactus/?ws=support)
PrerequisitesYou must have installed Windows 2000 Service Pack 4 (SP4) to apply this hotfix.Restart informationYou must restart the computer after you apply this hotfix.Registry informationYou do not have to change the registry.Hotfix file informationThis hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain of all the files that you must have to fully update a product to the latest build. 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.Collapse this table
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. MORE INFORMATIONAutomation
caches the space allocated for BSTRs. This speeds up the
SysAllocString/SysFreeString sequence. However, this may cause IMallocSpy to
attribute leaks to the wrong memory user because it is not aware of the caching
that Automation performs. For example, if the application allocates a BSTR and
frees it, the freed block of memory is put into the BSTR cache by Automation. If the application then allocates another BSTR, it may receive the free
block from the cache. If the second BSTR allocation is not freed, IMallocSpy
will attribute the leak to the first allocation of the BSTR. The correct leak
source (the second allocation) can be determined by disabling the BSTR caching
that Automation performs. You can do this by setting environment variable
OANOCACHE=1 before you run the application. On Windows 2000, the hotfix version of oleaut32.dll referenced in this article is required. It is also
important to look for leaks at the correct time to prevent false leak reports. These leaks may occur when the IMallocSpy implementation checks for leaks too soon. Users of
memory that is allocated by IMalloc can legitimately hold on to it after
OleUninitialize. For example, the Automation BSTR cache is deleted at the
Oleaut32.dll file's DLL_PROCESS_DETACH time. This means that checking for leaks
immediately after OleUninitialize may cause false reports of memory leaks. A
good place to look for memory leaks is in the destructor of a static instance
of a class, that implements IMallocSpy. The destructor of this static instance
is called after the DllMain of each DLL linked by the application is
called with DLL_PROCESS_DETACH. Set the OANOCACHE environment variable
REFERENCES
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
824684
(http://support.microsoft.com/kb/824684/
)
Description of the standard terminology that is used to describe Microsoft software updates
Properties | Article Translations
|



Back to the top








