FreeMem disposes of a dynamic variable.
Example:
if ap <> Nil then begin FreeMem(ap, nps*sizeof(TPoint)); ap:=Nil end;