[fpc-devel] Memory leak: bug ot as designed?

Bart bartjunk64 at gmail.com
Wed Mar 29 23:43:10 CEST 2023


On Wed, Mar 29, 2023 at 11:44 AM Ondrej Pokorny via fpc-devel
<fpc-devel at lists.freepascal.org> wrote:
>
> FYI: Delphi doesn't create a memory leak.
>

The memory leak seems to be related to string concatenation in the
getter for the Text property.
A getter like this is enough to get the leak:
function TBar.GetTextStr: String;
begin
  Result := 'X';
  Result := Result + 'Y';
end;

If the initial assigment to Result is an empty string, then no leak occurs.

I'll report it in the bugtracker.
-- 
Bart


More information about the fpc-devel mailing list