Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
SizeOf Function
◄Summary► ◄Details► ◄Example► ◄Back►
Argument
identifier Name of a variable or data type
Returns
Word Number of bytes occupied in memory by the argument
Description
The SizeOf function returns the amount of memory in bytes used by a
specific variable or a data type.
The identifier argument is the name of any variable or type,
whether defined in the program, the language, or a standard unit.
Use SizeOf to prevent overwriting memory when the FillChar,
FreeMem, GetMem, and Move procedures are used. Use SizeOf along
with the MaxAvail procedure to ensure that GetMem or New do not
generate a run-time error because of insufficient memory to
allocate a variable.
To get the size of the memory area pointed to by a typed pointer,
pass the pointer dereferenced by a caret, (^):
result := SizeOf( pointer_variable^ );