<!--
{
  "documentType" : "article",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/memory-utilities",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "Memory Utilities"
}
-->

# Memory Utilities

Allocate and deallocate memory and manage memory pointers in different address spaces.

## Topics

### Allocation

[`#define IONew(type, count)`](/documentation/DriverKit/IONew)

Allocates memory for an array of the specified type.

[`#define IONewZero(type, count)`](/documentation/DriverKit/IONewZero)

Allocates memory for an array of the specified type and zero-initializes that memory.

[`void *IOMalloc(size_t length);`](/documentation/DriverKit/IOMalloc)

Allocates the specified amount of general-purpose memory.

[`void *IOMallocZero(size_t length);`](/documentation/DriverKit/IOMallocZero)

Allocates the specified amount of general-purpose memory and zero-initializes it.

[`#define OSTypeAlloc(type)`](/documentation/DriverKit/OSTypeAlloc)

Allocates memory for a named class.

### Deallocation

[`#define IODelete(ptr, type, count)`](/documentation/DriverKit/IODelete)

Frees the memory associated with a valid, typed array.

[`#define IOSafeDeleteNULL(ptr, type, count)`](/documentation/DriverKit/IOSafeDeleteNULL)

Frees the memory associated with a typed array.

[`#define OSSafeReleaseNULL(inst)`](/documentation/DriverKit/OSSafeReleaseNULL)

Frees memory that you allocated for a named class.

[`void IOFree(void *address, size_t length);`](/documentation/DriverKit/IOFree)

Frees a memory block that contains general-purpose memory.

### Address Utilities

[`extern uint64_t IOVMPageSize;`](/documentation/DriverKit/IOVMPageSize)

The number of bytes in a virtual memory page.

### Addresses

[`typedef mach_vm_address_t IOVirtualAddress;`](/documentation/DriverKit/IOVirtualAddress)

An address in the virtual memory space of the process.

[`typedef IOPhysicalAddress64 IOPhysicalAddress;`](/documentation/DriverKit/IOPhysicalAddress)

An address in physical memory.

[`typedef UInt32 IOPhysicalAddress32;`](/documentation/DriverKit/IOPhysicalAddress32)

A 32-bit address in physical memory.

[`typedef UInt64 IOPhysicalAddress64;`](/documentation/DriverKit/IOPhysicalAddress64)

A 64-bit address in physical memory.

[`typedef IOPhysicalLength64 IOPhysicalLength;`](/documentation/DriverKit/IOPhysicalLength)

A type that represents the length of a memory block.

[`typedef UInt32 IOPhysicalLength32;`](/documentation/DriverKit/IOPhysicalLength32)

A type that represents the length of a memory block in a 32-bit address space.

[`typedef UInt64 IOPhysicalLength64;`](/documentation/DriverKit/IOPhysicalLength64)

A type that represents the length of a memory block in a 64-bit address space.

[`typedef UInt32 IOCacheMode;`](/documentation/DriverKit/IOCacheMode)

A memory-cache mode.

### Byte Counts

[`typedef IOByteCount64 IOByteCount;`](/documentation/DriverKit/IOByteCount)

A type that represents a number of bytes.

[`typedef UInt32 IOByteCount32;`](/documentation/DriverKit/IOByteCount32)

A type that represents a number of bytes in a 32-bit address space.

[`typedef UInt64 IOByteCount64;`](/documentation/DriverKit/IOByteCount64)

A type that represents a number of bytes in a 64-bit address space.



---

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)