[lazarus] StrAlloc,StrPcopy,StrDispose

Markku Niskanen markku.niskanen at laatumikro.fi
Fri Aug 20 13:49:28 EDT 1999


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

-- 
markku.niskanen at laatumikro.fi






More information about the Lazarus mailing list