<!--
{
  "availability" : [
    "DriverKit: -",
    "iOS: -",
    "iPadOS: -",
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "DriverKit",
  "identifier" : "/documentation/DriverKit/IOMemoryDescriptor/GetLength",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "DriverKit"
    ],
    "preciseIdentifier" : "c:@S@IOMemoryDescriptor@F@GetLength#*k#"
  },
  "title" : "GetLength"
}
-->

# GetLength

Returns the length of the memory block represented by this object.

```
kern_return_t GetLength(uint64_t *returnLength);
```

## Parameters

`returnLength`

A variable in which to put the length of the current memory block.

## Return Value

[`kIOReturnSuccess`](/documentation/DriverKit/kIOReturnSuccess) on success, or another value if an error occurs. See [Error Codes](/documentation/DriverKit/error-codes).

## Discussion

This method returns the effective size of the memory block, which might be less than the block’s total capacity.

## See Also

[`virtual kern_return_t SetLength(uint64_t length);`](/documentation/DriverKit/IOBufferMemoryDescriptor/SetLength)

Changes the length of the memory buffer.



---

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)