RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TAbstractNamedVariants.Capacity Property

Specifies the allocated size of the named variants list.

Pascal
property Capacity: Integer;
C++
__property int Capacity;

Set Capacity to the number of named Variants the list will need to contain. When a value is added to a list that is already filled to capacity, the Capacity property is automatically increased. Setting Capacity before adding values can reduce the number of memory reallocations and thereby improve performance. In addition, in descendants that allocate memory in chunks, setting Capacity can ensure that you do not allocate more memory for the list than your application needs. 

Read Capacity to learn number of values the list can hold without reallocating memory. Do not confuse Capacity with the Count property, which is the number of entries in the list that are in use. The value of Capacity is always greater than or equal to the value of Count. When Capacity is greater than Count, the unused memory can be reclaimed by setting Capacity to Count

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!