Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
This topic has not yet been rated - Rate this topic

IHostMemoryManager Interface

Provides methods that allow the common language runtime (CLR) to make virtual memory requests through the host, instead of using the standard Win32 virtual memory functions.


interface IHostMemoryManager : IUnknown {

    HRESULT CreateMAlloc (
        [in]  BOOL    fThreadSafe,
        [out] IHostMalloc **ppMalloc
    );

    HRESULT VirtualAlloc (
        [in]  void*   pAddress,
        [in]  SIZE_T  dwSize,
        [in]  DWORD   flAllocationType,
        [in]  DWORD   flProtect,
        [in]  EMemoryCriticalLevel dwCriticalLevel,
        [out] void**  ppMem
    );

    HRESULT VirtualFree (
        [in]  LPVOID  lpAddress,
        [in]  SIZE_T  dwSize,
        [in]  DWORD   dwFreeType
    );

    HRESULT VirtualQuery (
        [in]  void*   lpAddress,
        [out] void*   lpBuffer,
        [in]  SIZE_T  dwLength,
        [out] SIZE_T  *pResult
    );

    HRESULT VirtualProtect (
        [in]  void*   lpAddress,
        [in]  SIZE_T  dwSize,
        [in]  DWORD   flNewProtect,
        [out] DWORD*  pflOldProtect
    );

    HRESULT GetMemoryLoad (
        [out] DWORD*  pMemoryLoad, 
        [out] SIZE_T  *pAvailableBytes
    );

    HRESULT RegisterMemoryNotificationCallback (
        [in]  ICLRMemoryNotificationCallback* pCallback
    );

    HRESULT NeedsVirtualAddressSpace(
        [in]  LPVOID  startAddress,
        [in]  SIZE_T  size
        );

    HRESULT AcquiredVirtualAddressSpace(
        [in]  LPVOID  startAddress,
        [in]  SIZE_T  size
        );

    HRESULT ReleasedVirtualAddressSpace(
        [in]  LPVOID  startAddress
        );
};

Method

Description

IHostMemoryManager::AcquiredVirtualAddressSpace Method

Notifies the host that the common language runtime (CLR) has acquired the specified memory from the operating system.

IHostMemoryManager::CreateMAlloc Method

Gets an interface pointer to an IHostMAlloc instance that is used to request memory allocations from a heap created by the host.

IHostMemoryManager::GetMemoryLoad Method

Gets the amount of physical memory that is currently being used, as reported by the host.

IHostMemoryManager::NeedsVirtualAddressSpace Method

Notifies the host that the CLR is going to attempt to use the specified memory.

IHostMemoryManager::RegisterMemoryNotificationCallback Method

Registers a pointer to a callback function that the host invokes to notify the CLR of the current memory load on the computer.

IHostMemoryManager::ReleasedVirtualAddressSpace Method

Notifies the host that the CLR has finished using the specified memory.

IHostMemoryManager::VirtualAlloc Method

Serves as a logical wrapper for the corresponding Win32 function, which reserves or commits a region of pages in the virtual address space of the calling process.

IHostMemoryManager::VirtualFree Method

Serves as a logical wrapper for the corresponding Win32 function, which releases, decommits, or releases and decommits a region of pages within the virtual address space of the calling process.

IHostMemoryManager::VirtualProtect Method

Serves as a logical wrapper for the corresponding Win32 function, which changes the protection on a region of committed pages in the virtual address space of the calling process.

IHostMemoryManager::VirtualQuery Method

Serves as a logical wrapper for the corresponding Win32 function, which retrieves information about a range of pages in the virtual address space of the calling process.

IHostMemoryManager also provides methods for the CLR to obtain a pointer through which to make memory requests on the heap and to get the level of memory pressure in the process, as reported by the host.

Platforms: Windows 2000, Windows XP, Windows Server 2003 family

Header: MSCorEE.idl

Library: Included as a resource in MSCorEE.dll

.NET Framework Version: 2.0

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft. All rights reserved.