Training
×

Shared Memory: Creating

AllocateRtMemory allocates page-aligned blocks of physical memory out of the process memory pool. The call automatically rounds up the length (in bytes) to a multiple of 4K. The allocated pages are contiguous; they start and end on 4K boundaries.
To share memory with a thread in another process, a thread in the owning process must execute CreateRtMemoryHandle. This creates a unique handle to be used to share the memory with other processes.
DeleteRtMemoryHandle does not return the physical memory to the process memory pool, it only frees up the handle.
FreeRtMemory deletes all contiguous physical memory at the address in AllocateRtMemory.
 
DeleteRtMemoryHandle and FreeRtMemory do not check if the handle and/or memory is in use by other processes. Thus do these calls only when all other processes have finished using the shared memory.