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

TMemoryStream.Capacity

Current capacity of the stream.

Declaration

Source position: classesh.inc line 890

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

The latest version of this document can be found at lazarus-ccr.sourceforge.net.