Share via

Memory Allocation


Indexing Service is no longer supported as of Windows XP and is unavailable for use as of Windows 8. Instead, use Windows Search for client side search and Microsoft Search Server Express for server side search.


Ownership of command trees may be transferred by means of several different methods in OLE DB. A transfer of ownership occurs when a component that allocates a command tree is no longer responsible for freeing the allocated resources. For example, command trees may be obtained by data consumers by means of the ICommandTree::GetCommandTree method. In order for this transfer to succeed, a standard for allocation and de-allocation must be identified.

In general, the standard OLE task allocator interface (IMalloc), obtained by calling CoGetMalloc, should be used for allocating and releasing the memory. DBCOMMANDTREE nodes and the values embedded therein are allocated using IMalloc::Alloc and released by means of IMalloc::Free, with the following exceptions:

All other pointers embedded in a command tree are assumed to have been dynamically allocated with IMalloc::Alloc and will be released with IMalloc::Free.

When allocating a tree that will not change ownership, you can use any method of allocation except in the three cases above, because those values also have special copy functions.