The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,329 other followers

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

Posted by jpluimers on 2018/01/09

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:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: