# BufferWriterBox&lt;TBufferWriter&gt;.GetMemory(int)

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.adaptors.bufferwriterbox-1/) | [Methods](/orleans/docs/api/csharp/microsoft.orleans.serialization/orleans.serialization.buffers.adaptors.bufferwriterbox-1/methods/)

[Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.Serialization/Buffers/Adaptors/BufferWriterBox.cs#L27)

```csharp
public Memory<byte> GetMemory(int sizeHint = 0)
```

Returns a `System.Memory-1` to write to that is at least the requested size (specified by `sizeHint`).

### Parameters

- `sizeHint` (`int`): The minimum length of the returned `System.Memory-1`. If 0, a non-empty buffer is returned.

### Returns

A `System.Memory-1` of at least the size `sizeHint`. If `sizeHint` is 0, returns a non-empty buffer.

### Exceptions

- `System.OutOfMemoryException`: The requested buffer size is not available.
