[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2

NetSpirit netspirit at meta.ua
Thu May 20 14:43:41 CEST 2021


RTL not modified. Just recompilation of 'sysinitpas.pp' unit with some
options causes problem.

Here is another test project that uses your current official FPC
installation with unmodified RTL:
http://dl.free.fr/ePtkQwgJJ

Test project contains source of 'sysinitpas.pp' (and required
'sysinit.inc', 'systlsdir.inc').
Used version 3.2.2 RC1. If you have another - get sources for your version.

Script 'compile.bat' compiles 'sysinitpas.pp' and then - test project
'test.pp'.
See comments inside.

'test_bad.exe' shows growing memory consumption.


> Hello,
>
> Your test program runs fine when compiled with FPC 3.2.0 using the
official RTL compiled with -O2. No memory leak.
> I suppose the issue is caused by your modifications to RTL. -O2
(regvars) just triggers the problem in the modified RTL code which is
hidden when regvars are disabled.



More information about the fpc-devel mailing list