SetOaNoCache Function

Disables the BSTR caching in OleAut32.dll.

void SetOaNoCache();

OLE Automation caches the space allocated for BSTR strings. The SetOaNoCache function immediately disables the oleaut32.dll BSTR caching mechanism. All further allocations and deallocations are passed directly to the process allocator. Cached BSTRs are not released. This function should be called before any BSTR operations take place in the process. BSTR caching can also be disabled at the machine level by setting the environment variable OANOCACHE=1.

The following code example demonstrates the use of the SetOaNoCache function.

inline void TurnOffCache ()
    // Function prototype.
    extern "C" SetOaNoCache(); 
    // Turn off BSTR caching.