Hi is the following allowed or will it cause problems:

type

PObj = ^TObj;
TObj = object
  constructor Init;
end;

var
 Obj : PObj;
begin
 Obj := new(PObj, Init);
 FreeMem(Obj); // This is the line I wonder about.
end;

I compiled this and it doesn't throw any exceptions.

Should I only use Dispose(Obj) ?

Maybe Dispose can call a destructor and that is the difference between
Dispose and FreeMem?



Thanks,

Andrew Haines
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to