SetLength
SetLength is a term used in several programming languages to describe an operation that adjusts the declared length of a dynamic array or a string. The routine typically allocates or releases memory to match the new length and may initialize newly created elements to default values. Negative lengths are usually invalid and may raise an error.
In Pascal and its descendants such as Delphi and Free Pascal, SetLength is a standard procedure. It
Other languages provide similar functionality under different names or mechanisms. For example, some environments offer a
Semantics and considerations vary by language design. Resizing may move the underlying memory and invalidate references