1{$ifdef fpc}{$MODE OBJFPC }{$endif} 2type 3 PTestRec = ^TestRec; 4 TestRec = record 5 fString : AnsiString; 6 fInt1 : Longint; 7 fInt2 : Longint; 8 fRetAddr : Longint; 9 end; 10 11function GetGroupInfoP: PTestRec; 12var 13 s : string; 14begin 15 new(Result); 16 s:=' Wr'; 17 Result^.fString := 'Test' + s; 18 Result^.fRetAddr := 0; 19end; 20 21function GetGroupInfo: TestRec; 22var 23 s : string; 24begin 25 s:=' Wr'; 26 Result.fString := 'Test' + s; 27 Result.fRetAddr := 0; 28end; 29 30function SelectGroup: TestRec; 31begin 32 Result := GetGroupInfo; 33end; 34 35procedure p; 36begin 37 SelectGroup; 38end; 39 40procedure destroystack; 41var 42 s : shortstring; 43 p : pchar; 44 i : longint; 45begin 46 for i:=0 to 255 do 47 s[i]:=#$90; 48 getmem(p,sizeof(TestRec)); 49 for i:=0 to sizeof(TestRec)-1 do 50 p[i]:=#$ff; 51 freemem(p); 52end; 53 54var 55 p1 : PTestRec; 56begin 57 destroystack; 58 p; 59 p1:=GetGroupInfoP; 60 dispose(p1); 61end. 62