A lot Delphi versions have a problem with uninstalling the memory manager.
For more details please look at QC105766
(http://qc.embarcadero.com/wc/qcmain.aspx?d=105766)
I suggest the enclosed patch for a proper uninstall the MM.
Use the "ExitProcessProc" (unit system.pas) to uninstall the MM instead of
the finalization in unit FastMM.pas, because the unit finalization is too
early.
the suggested workaround has one problem: The ExitProc will not called inside a DLL, because the code in system.pas ...
if InitContext.DllInitState <> 0 then
ExitDll(@InitContext);
is before ...
if Assigned(ExitProcessProc) then
ExitProcessProc;
The (workaround) FastMM of the DLL do not call FinalizeMemoryManager. Maybe we make a decision inside FastMM.pas finalization part to call FinalizeMemoryManager for a DLL (if IsLibrary...). But than we have the old problem again, that FreeMem(PreferredLanguagesOverride) will be called after FinalizeMemoryManager. For this case we need again Embarcadero System.QC105766.pas for the DLL :-(
Regards
ma2xx
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A lot Delphi versions have a problem with uninstalling the memory manager.
For more details please look at QC105766
(http://qc.embarcadero.com/wc/qcmain.aspx?d=105766)
I suggest the enclosed patch for a proper uninstall the MM.
Use the "ExitProcessProc" (unit system.pas) to uninstall the MM instead of
the finalization in unit FastMM.pas, because the unit finalization is too
early.
Enjoy
Ma2xx
Last edit: Maxx 2013-11-12
Thanks Maxx,
I've scanned through your changes and it looks good. I just need to test first to make sure there are no unwanted side-effects.
Best regards,
Pierre
Hello Pierre,
the suggested workaround has one problem: The ExitProc will not called inside a DLL, because the code in system.pas ...
if InitContext.DllInitState <> 0 then
ExitDll(@InitContext);
is before ...
if Assigned(ExitProcessProc) then
ExitProcessProc;
The (workaround) FastMM of the DLL do not call FinalizeMemoryManager. Maybe we make a decision inside FastMM.pas finalization part to call FinalizeMemoryManager for a DLL (if IsLibrary...). But than we have the old problem again, that FreeMem(PreferredLanguagesOverride) will be called after FinalizeMemoryManager. For this case we need again Embarcadero System.QC105766.pas for the DLL :-(
Regards
ma2xx