[Overview][Constants][Types][Classes][Procedures and functions][Variables] | Reference for unit 'Classes' (#fcl)

# TMemoryStream.Capacity

Current capacity of the stream.

## Declaration

`protected property TMemoryStream.Capacity: LongInt read FCapacity write SetCapacity;`

## Description

Capacity is the current capacity of the stream, this is the current size of the memory allocated to the stream. This is not necessarily equal to the size of the stream, but will always be larger than or equal to the size of the stream. When writing to the stream, the TMemoryStream.Write sets the capacity to the needed value.

If a lot of write operations will occur, performance may be improved by setting the capacity to a large value, so less reallocations of memory will occur while writing to the stream.

## See also

TMemoryStream.ReAlloc |  | Sets the new capacity for the memory stream