<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ModelIO",
  "identifier" : "/documentation/ModelIO/MDLMeshBufferAllocator/newBuffer(from:length:type:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Model I/O"
    ],
    "preciseIdentifier" : "c:objc(pl)MDLMeshBufferAllocator(im)newBufferFromZone:length:type:"
  },
  "title" : "newBuffer(from:length:type:)"
}
-->

# newBuffer(from:length:type:)

Creates a new buffer of the specified length in the specified zone.

```
func newBuffer(from zone: (any MDLMeshBufferZone)?, length: Int, type: MDLMeshBufferType) -> (any MDLMeshBuffer)?
```

## Parameters

`zone`

A pool of memory for related allocations, as returned by the [`newZone(_:)`](/documentation/ModelIO/MDLMeshBufferAllocator/newZone(_:)) method.

`length`

The size, in bytes, of the buffer to create.

`type`

Use [`MDLMeshBufferType.vertex`](/documentation/ModelIO/MDLMeshBufferType/vertex) to create a buffer for a mesh’s vertex attribute data, or [`MDLMeshBufferType.index`](/documentation/ModelIO/MDLMeshBufferType/index) to create a buffer for a submesh’s index data.

## Return Value

A new memory buffer for mesh data.

## Discussion

Use this method when making multiple related allocations that should share the same memory pool.

The concrete class implementing this protocol determines the initial contents of the 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)