[fpc-devel] Heaptrace + cwstring cause SIGSEGV at the end

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Mar 10 18:19:48 CET 2014


On 10 Mar 2014, at 17:17, Sergei Gorelkin wrote:

> 10.03.2014 19:40, Jonas Maebe пишет:
>> 
>> On 10 Mar 2014, at 16:13, Petr Kristan wrote:
>> 
>>> If memoryleak occurs and program ends, then i get SIGSEGV in cwstring.pp:481 (iconv call)
>>> because cwstring unit is finalized before heaptrc.
>> 
>> 
>> If you use -gh, then heaptrc will be the first unit of the uses clause and will be finalized after
>> any manually added unit.
>> 
> That's exactly the issue. Being finalized last, heaptrc must not do anything that depends on functionality from other units, except system, but it does due to recent Unicode-related changes (indirectly, see the stack trace).
> 
> Even further, in case of error RTL tries to print a backtrace right after finalizing all units (see InternalExit procedure in system.inc), which can lead to similar problems.

You're right. We should probably reinstally the previous (default) widestring manager in the finalization section of cwstring).


Jonas


More information about the fpc-devel mailing list