[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'db' (#fcl)

# DisposeMem

Dispose of a heap memory block and Nil the pointer (deprecated)

## Declaration

Source position: db.pas line 2083

`procedure DisposeMem(`
`var Buffer;`
`Size: Integer`
`);`

## Arguments

`Buffer` |  | Pointer to memory area
`Size` |  | Size of the memory block

## Description

DisposeMem disposes of the heap memory area pointed to by Buffer (Buffer must be of type Pointer). The Size parameter indicates the size of the memory area (it is, in fact, ignored by the heap manager). The pointer Buffer is set to Nil. If Buffer is Nil, then nothing happens. Do not use DisposeMem on objects, because their destructor will not be called.

## Errors

If Buffer is not pointing to a valid heap memory block, then memory corruption may occur.

## See also

#rtl.system.FreeMem
#rtl.sysutils.freeandnil

The latest version of this document can be found at lazarus-ccr.sourceforge.net .