[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2
NetSpirit
netspirit at meta.ua
Thu May 20 10:55:32 CEST 2021
You can simply compile this file by yourself using your existing FPC
installation.
1) Get 'rtl\win32\sysinitpas.pp' and 'rtl\win32\sysinit.inc' from
repository or sources archive.
2) Create build script ('compile.bat'):
REM Change this path's to your FPC installation, e.g.:
set FPC_DIR=c:\FPC
set FPC_BINARY=%FPC_DIR%\bin\i386-win32\ppc386.exe
set UNITS_DIR=%FPC_DIR%\units\i386-win32\*
"%FPC_BINARY%" -Fu"%UNITS_DIR%" -O2 -Mobjfpc "sysinitpas.pp"
=======
Here is test project that show bug: http://dl.free.fr/ckmK7KVPX
Test project with full environment (compiler and minimal RTL):
http://dl.free.fr/nHDbSOzOQ
> Hmmm, I've seen regvar problems before. Can you provide the assembly
> dumps of that file under -O2 and -O2 -OoNOREGVAR respectively? It might
> reveal something.
>
> Gareth aka. Kit
>
> On 20/05/2021 09:07, NetSpirit via fpc-devel wrote:
>> Answer for my previous message
>>
(https://lists.freepascal.org/pipermail/fpc-devel/2021-January/043512.html).
>>
>> Memory leak happens when unit 'rtl\win32\sysinitpas.pp' compiled with
>> "-O2" or higher.
>> To eliminate this bug add "-O-" or
"-OoNOREGVAR" to command-line when
>> compile this unit. This disables optimizations when enabled in 'fpc.cfg',
>> e.g:
>>
>> %FPC_COMMAND% -O- -Mobjfpc win32\sysinitpas.pp
>>
>> or
>>
>> %FPC_COMMAND% -OoNOREGVAR -Mobjfpc win32\sysinitpas.pp
>>
More information about the fpc-devel
mailing list