<!--
{
  "availability" : [
    "macOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZGuestMemoryMapping",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(cs)VZGuestMemoryMapping"
  },
  "title" : "VZGuestMemoryMapping"
}
-->

# VZGuestMemoryMapping

An object that represents a chunk of the guest operating system’s dynamic random access memory (DRAM).

```
class VZGuestMemoryMapping
```

## Overview

A `VZGuestMemoryMapping` object provides read and write access to guest’s DRAM for a [`VZCustomVirtioDevice`](/documentation/Virtualization/VZCustomVirtioDevice)
for Virtio devices that need to directly interact with the guest’s DRAM.

Don’t instantiate a`VZGuestMemoryMapping` objects directly. Instead, call the
[`guestMemoryMapping(atPhysicalAddress:length:)`](/documentation/Virtualization/VZCustomVirtioDevice/guestMemoryMapping(atPhysicalAddress:length:)) method
and the framework creates a `VZGuestMemoryMapping` object for you.

Throughout its lifetime, a `VZGuestMemoryMapping` object holds a reference to the all of the host memory allocated for the guest’s DRAM.
When the virtual machine is rebooted or shutdown, the allocated host memory becomes invalidated and remapped. As such, an instance of
`VZGuestMemoryMapping` can’t be used across a reboot or shutdown of the virtual machine.

## Topics

### Instance Properties

[`var length: Int`](/documentation/Virtualization/VZGuestMemoryMapping/length)

The number of bytes contained by this guest memory mapping object.

[`var mutableBytes: UnsafeMutableRawPointer`](/documentation/Virtualization/VZGuestMemoryMapping/mutableBytes)

A pointer to the data this guest memory mapping object contains.

[`var physicalAddress: UInt64`](/documentation/Virtualization/VZGuestMemoryMapping/physicalAddress)

The guest’s physical memory base address of this guest memory mapping object.

## See Also

[`class VZCustomVirtioDevice`](/documentation/Virtualization/VZCustomVirtioDevice)

An interface that represents a custom Virtio device that you provide the implementation for.

## Relationships

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

### Conforms To

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Hashable`](/documentation/Swift/Hashable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)