SizeOf Function
The SizeOf
function returns the number of bytes
that Value
or
type
occupies, which can be an expression
or a type identifier. SizeOf
is not a real
function.
A common use for SizeOf
is when calling
GetMem
, so you know how much memory to
request.
The size of a pointer, object reference, or class reference is 4 because a pointer fits into 4 bytes (but future versions of Delphi might require more memory to store a pointer).
To learn the number of bytes an object takes up, call the
class’s InstanceSize
method.