The {$CHECKPOINTER} directive turns heap pointer checking on (value ON) or off (value OFF). If heap pointer checking is on and the code is compiled with the -gh (heaptrace) option on, then a check is inserted when dereferencing a pointer. The check will verify that the pointer contains a valid value, i.e. points to a location that is reachable by the program: the stack or a location in the heap. If not, a run-time error 216 or 204 is raised.
If the code is compiled without -gh switch, then this directive has no effect. Note that this considerably slows down the code.
Note that this only works for pointers managed by FPC. If you receive and use pointers from external libraries, the checks will fail.