Click or drag to resize

AllocateMemory

Allocate memory from a device’s memory region.

virtual HRESULT AllocateMemory(UINT64 ullSize, UINT64* pullOffset) abstract;
Parameters
ullSize

[in] Size of the allocation.

pullOffset

[out] Offset into device memory region where memory has been allocated.

Return Value

Returns S_OK if successful, otherwise a failure HRESULT.

Remarks

The AllocateMemory function returns an offset into a device’s memory region that has been allocated for use by this session. If the device is located on the local interface card, the memory can be allocated either on the device itself or on the computer’s system memory.

Example

The following example demonstrates use of the AllocateMemory function.

C++
// CoAcme4321.cpp
STDMETHODIMP Acme4321::IAcme4321_Configure()
{
  UINT64 ullOffset;
  hr = io.Memory.AllocateMemory(100, &ullOffset);

  // ...

  hr = io.Memory.FreeMemory(ulOffset);

  return hr;
}

Download a complete CHM version of this documentation here.