Sign in Join
FPDoc Onlineexperiment

TMemoryStream.Realloc function

Member of TMemoryStreamprotectedIn unit Classes

Sets the new capacity for the memory stream.

Declaration

pascal
function Realloc(var NewCapacity: PtrInt): Pointer; virtual

Description

SetCapacity sets the capacity of the memory stream, i.e. does the actual allocation or de-allocation of memory for the stream. It allocates at least NewCapacity bytes on the heap, moves the current contents of the stream to this location (as much as fits in) and returns the new memory location. Extra allocated memory is not initialized, i.e. may contain garbage.

Memory is allocated in blocks of 4 Kb; this can be changed by overriding the method.

See also

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