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

# newBuffer(_:type:)

Creates a new buffer of the specified length.

## Declaration

```swift
func newBuffer(_ length: Int, type: MDLMeshBufferType) -> any MDLMeshBuffer
```

## Parameters

- `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 The concrete class implementing this protocol determines the initial contents of the buffer and the memory pool from which the buffer is allocated. To provide a hint that multiple related allocations should share the same pool of memory, use the newBuffer(from:length:type:) method instead.

## See Also

### Allocating Mesh Buffers

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