[fpc-devel] Memory leak on BeginThread() when RTL compiled with -O2
NetSpirit
netspirit at meta.ua
Mon Jan 11 09:30:30 CET 2021
I am using custom build of minimal FPC RTL and found possible bug. When
unit 'system' (or some other?) compiled using -O2 (or higher) option in
'fpc.cfg', then application, compiled using this unit, increase memory
usage every time BeginThread() function is called.
This appears on FPC 3.2.0 and not happens in earlier versions. Tested on
official FPC binary for Windows, target platform - 'win32'/'win64'.
Here is complete test environment - minimal RTL sources, FPC executables
and test project: http://dl.free.fr/ckmK7KVPX
Steps to reproduce:
1) Unpack archive
2) Execute script 'FPC\src\make_RTL_32A.bat' to build RTL.
Current 'FPC\fpc.cfg' contains -O2 option enabled
3) Execute script 'compile.bat' to build test project.
4) Execute 'test.exe', then run Windows 'Task Manager' to view used memory.
Test project repeatedly creates thread with 500ms sleep.
Every time thread created, memory used by 'test.exe' is increased
Repeat steps 2-4 after comment out '-O2' option in 'FPC\fpc.cfg' or
replacing FPC binary with provided 'FPC\ppc386 3.0.4 - WORK.exe' (or your
own) - memory will remains stable.
If you have configured own RTL compilation - here is just test project
without FPC binaries and RTL sources: http://dl.free.fr/nHDbSOzOQ
Just change FPC path's in 'compile.bat'.
Please anyone confirm this behaviour.
More information about the fpc-devel
mailing list