Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 1999-08

StrAlloc,StrPcopy,StrDispose

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Markku Niskanen

Now that the mailing list is working again, lets
try to resend this message:
-------------------------------------------------------------- Shane and I have been debugging the editor and the crashing seems to be due to memory leaks with
StrAlloc, StrPcopy and StrDispose.

Have I misunderstood something or is there something else wrong with this piece of software:

program memtest;
uses sysutils;
var pStr: Pchar;
    st  : String;
begin
    St := '12345678901234567890';
    Writeln('Mem             : ',memavail());
    pStr := StrAlloc(21);
    Writeln('After StrAlloc  : ',memavail());
    strPcopy(pStr,st);
    Writeln('After strPcopy  : ',memavail());
    StrDispose(pStr);
    Writeln('After strDispose: ',memavail());
end.

The result is:

Mem : 262064
After StrAlloc : 262032
After strPcopy : 261984
After strDispose: 262016

and you can see the memory leaks :-(

Markku

Reply by email