---
title: "unmapMemory(atOffset:size:completionHandler:)"
framework: virtualization
role: symbol
role_heading: Instance Method
path: "virtualization/vzvirtiosharedmemoryregion/unmapmemory(atoffset:size:completionhandler:)"
---

# unmapMemory(atOffset:size:completionHandler:)

Unmaps a chunk of host memory from the shared memory region.

## Declaration

```swift
func unmapMemory(atOffset offset: UInt64, size: UInt64, completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
func unmapMemory(atOffset offset: UInt64, size: UInt64) async throws
```

## Parameters

- `offset`: The offset from the start of the shared memory region where the memory should be unmapped.
- `size`: The size of the memory to be unmapped from the shared memory region.
- `completionHandler`: Block called after memory has been successfully unmapped or on error. The error parameter passed to the block is nil if the unmap operation is successful. The framework invokes the block on doc://com.apple.virtualization/documentation/Virtualization/VZCustomVirtioDevice/deviceQueue.
