delphicrashaccess-violationfastmm

FastMM crashes on 64 bits when debug info (MAP file) is present


I am trying to compile an old program for 64 bits (Win7, Delphi XE7). However, I have a problem with FastMM. Instead of showing the leak report it crashes in FastMM_FullDebugMode64.dll

The error is:

---------------------------
Debugger Exception Notification
---------------------------
Project TestCompile.exe raised exception class $C0000005 with message 'c0000005 ACCESS_VIOLATION'.

enter image description here

This is the code necessary to reproduce the issue:

program TestCompile;
uses
  fastmm4,
  Vcl.Forms, Unit1 in 'Unit1.pas' {Form1}; {$R *.res}
begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


UNIT Unit1;
...  
IMPLEMENTATION  

VAR TSL: TStringList;
procedure TForm1.Button1Click(Sender: TObject);
begin
 TSL:= TStringList.Create;  // we generate a leak here. fastmm should report this
end;

end.

As you can see there is no personal/3rd party code. All is done with Delphi code.
The DLL is the one provided with FastMM (4.992/2016) package.

It works on 32 bit. On 64 bits, it crashes the program if I run under IDe (debugger). I can only Reset the program (ctrl+f2). Outside the IDE the program just works (FastMM is configure not to show the log when running outside the IDE).

Update: This has something to do with the presence of debug info ('Map file' under 'Delphi compiler -> Linking').


Solution

  • It looks like the precompiled 64bit DLL contained in the repository is outdated and does not reflect changes done in the past.

    There was a potential crash when the executable does not contain debug information.

    From FastMM_FullDebugMode.dpr

    Version 1.61 (5 September 2010):
      - Recompiled using the latest JCL in order to fix a possible crash on shutdown
        when the executable contains no debug information. (Thanks to Hanspeter
        Widmer.)
    

    Recompiled the DLL using a rather recent JCL and it does not crash anymore.

    Also reported this: https://github.com/pleriche/FastMM4/issues/27