Quantcast
Channel: Delphi – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 1445

Some FastMM scenarios require NeverUninstall because the System unit finalizes things innitialised in other units

$
0
0

You always have to be careful  with Delphi finalization sections cleaning up things that might have not created inside the corresponding initialization section. This is especially true for the System unit.

That one actually contains this little piece of code that is being called after FinalizeUnits is called which also fianalises external memory managers like FastMM:

finalization
{$IFDEF WEAKREF}
  InstHashMap.Finalize;
{$ENDIF}...
{$IFDEF MSWINDOWS}
 FinalizeLocaleDate;
 if PreferredLanguagesOverride <> nil then
 FreeMem(PreferredLanguagesOverride);
...

Which means that you will have to enable the NeverUninstall conditional define as soon as the InstHashMap has been used.

Most often that’s the case with FMX applications that heavily relies on weak references.

The same holds for PreferredLanguagesOverride which is used by SetLocaleOverride and can be worked around by performing this right at the end of the .dpr:

SetLocaleOverride('');

–jeroen

via:


Viewing all articles
Browse latest Browse all 1445

Trending Articles