<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMBlockBufferCreateEmpty(allocator:capacity:flags:blockBufferOut:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@F@CMBlockBufferCreateEmpty"
  },
  "title" : "CMBlockBufferCreateEmpty(allocator:capacity:flags:blockBufferOut:)"
}
-->

# CMBlockBufferCreateEmpty(allocator:capacity:flags:blockBufferOut:)

Creates an empty block buffer.

```
func CMBlockBufferCreateEmpty(allocator structureAllocator: CFAllocator?, capacity subBlockCapacity: UInt32, flags: CMBlockBufferFlags, blockBufferOut: UnsafeMutablePointer<CMBlockBuffer?>) -> OSStatus
```

## Parameters

`structureAllocator`

Allocator to use for allocating the `CMBlockBuffer` object. `NULL` will cause the default allocator to be used.

`subBlockCapacity`

Number of sub-blocks the new `CMBlockBuffer` shall accommodate before expansion occurs. A value of zero means “do the reasonable default”.

`flags`

Feature and control flags.

`blockBufferOut`

Receives newly-created empty `CMBlockBuffer` object with retain count of 1. Must not be  `NULL`.

## Return Value

Returns `kCMBlockBufferNoErr` if successful.

## Discussion

Creates an empty `CMBlockBuffer`, i.e. one which has no memory block nor reference to a `CMBlockBuffer` supplying bytes to it. It is ready to be populated using `CMBlockBufferAppendMemoryBlock`()  and/or `CMBlockBufferAppendBufferReference`. `CMBlockBufferGetDataLength` will return zero for an empty `CMBlockBuffer` and `CMBlockBufferGetDataPointer` and `CMBlockBufferAssureBufferMemory` will fail.The memory for the `CMBlockBuffer` object will be allocated using the given allocator. If `NULL` is passed for the allocator, the default allocator is used.

---

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)