Home > Back-end >  How to release a function getmem?
How to release a function getmem?

Time:09-25

This 10 bytes don't have to lose?
Public
The list: tlist;
{Public declarations}
Procedure p (a: tlist);
end;

Var
Form1: TForm1;

Implementation

{$R *. DFM}

Procedure TForm1. P (a: tlist);
Var p1: PAnsiChar;
The begin
Getmem (p1, 10);
FillChar (p1 ^, 9 + 1, 0).
P1:=PAnsiChar (' 1234567890 ');
A.A dd (p1);
end;



Procedure TForm1. Button1Click (Sender: TObject);
Var p1: string;
P2: PAnsiChar;
Asd: Real;
The begin
P (list);
P2:=list. The Items [0].
Showmessage (p2);
//the list. The Delete (0);
//list. Remove (0);

//freemem (p2);
List. The Clear;
List. Free;
end;

CodePudding user response:

Getmem fillchar don't, '1234567890' is the pchar

CodePudding user response:

reference 1st floor a295281315 response:
Getmem fillchar don't, '1234567890' is this pchar

In fact this is not a problem, which represents the literally make point data, the key is
How to avoid to add Tlist freemem will release data
Or think of a way of explaining things so I can freemem

CodePudding user response:

The question now is out of memory
  • Related