from the delphi help

Assigned can't detect a dangling pointer--that is, one that isn't nil but no longer points to valid data. For example, in the code example for Assigned, Assigned won't detect the fact that P isn't valid.
sample code from delphi help

Code:
var P: Pointer;

begin
  P := nil;
  if Assigned (P) then Writeln ('You won''t see this');
  GetMem(P, 1024);	{P valid}
  FreeMem(P, 1024);	{P no longer valid and still not nil}

  if Assigned (P) then Writeln ('You''ll see this');
end;

how would i check if P points to valid memory? and would it work to check if it points to a class i need?



[edit]

1 way to do it is to check if a pointer inside the class is assigned and catch any access violation. but thats nasty and no good if running through the ide