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.
You need to debug the thread code in your modified RTL by yourself and find out 
what exactly causes the memory leak and why.
If there is indeed a bug in the regvars implementation you need to create a simple test program which triggers the bug. This is a common practice for such issues. Only such way it can be fixed.

Yuriy Sydorov,
j...@cp-lab.com

On 20.05.2021 11: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




_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to