Sign in Join
FPDoc Onlineexperiment

TMemoryStream.Capacity property

Member of TMemoryStreamprotectedIn unit Classes

Current capacity of the stream.

Declaration

pascal
property Capacity: PtrInt 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 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

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.