<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMBlockBuffer/append(length:allocator:deallocator:range:flags:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Media",
      "CoreMedia"
    ],
    "preciseIdentifier" : "s:So16CMBlockBufferRefa9CoreMediaE6append6length9allocator11deallocator5range5flagsySi_SvSgSicySv_SitcSnySiGSgAbCE5FlagsVtKF"
  },
  "title" : "append(length:allocator:deallocator:range:flags:)"
}
-->

# append(length:allocator:deallocator:range:flags:)

Adds a memory block to a block buffer using a custom allocator and deallocator.

```
func append(length: Int, allocator: @escaping CMBlockBuffer.CustomBlockAllocator, deallocator: @escaping CMBlockBuffer.CustomBlockDeallocator, range: Range<Int>? = nil, flags: CMBlockBuffer.Flags = []) throws
```

## Parameters

`length`

The length of the memory block in bytes. Must not be zero. This is the size to allocate when you call the [`assureBlockMemory()`](/documentation/CoreMedia/CMBlockBuffer/assureBlockMemory()) function.

`allocator`

An object that allocates a memory block.

`deallocator`

An object that deallocates a memory block.

`range`

The range within the memory block to which the block buffer should refer to data. If this value is `nil`, the block buffer uses the whole memory block.

`flags`

Feature and control flags.

---

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)