---
title: "newBuffer(from:length:type:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdlmeshbufferallocator/newbuffer(from:length:type:)"
---

# newBuffer(from:length:type:)

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

## Declaration

```swift
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 doc://com.apple.modelio/documentation/ModelIO/MDLMeshBufferAllocator/newZone(_:) method.
- `length`: The size, in bytes, of the buffer to create.
- `type`: Use doc://com.apple.modelio/documentation/ModelIO/MDLMeshBufferType/vertex to create a buffer for a mesh’s vertex attribute data, or doc://com.apple.modelio/documentation/ModelIO/MDLMeshBufferType/index to create a buffer for a submesh’s index data.

## Return Value

Return Value A new memory buffer for mesh data.

## Discussion

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.

## See Also

### Allocating Mesh Buffers

- [newZone(_:)](modelio/mdlmeshbufferallocator/newzone(_:).md)
- [newZoneForBuffers(withSize:andType:)](modelio/mdlmeshbufferallocator/newzoneforbuffers(withsize:andtype:).md)
- [newBuffer(_:type:)](modelio/mdlmeshbufferallocator/newbuffer(_:type:).md)
- [newBuffer(with:type:)](modelio/mdlmeshbufferallocator/newbuffer(with:type:).md)
- [newBuffer(from:data:type:)](modelio/mdlmeshbufferallocator/newbuffer(from:data:type:).md)
