Recent

Author Topic: an Error message appears after mem-leaks message  (Read 2004 times)

tambok

  • New member
  • *
  • Posts: 12
an Error message appears after mem-leaks message
« on: October 14, 2018, 10:03:19 am »
Hallo everyone and master,

I tried to create a project, but found an error after the memory check message appeared less than 1 minute.
then I tried to make one simple test.
1 stringgrid, 1 button and 1 opendialog.

i just make  procedure:

procedure TForm1.Button1Click(Sender: TObject);
var
  filename:String;
begin
  if OpenDialog1.Execute then
   begin
     filename:=OpenDialog1.FileName;
     StringGrid1.LoadFromCSVFile(filename,',',True,0,True);
   end;
end;

and the error still exist.

Does anyone know why this error message appears?


thanks

tbk

Thaddy

  • Hero Member
  • *****
  • Posts: 7611
Re: an Error message appears after mem-leaks message
« Reply #1 on: October 14, 2018, 10:26:00 am »
That code should not cause that. Try to compile with line info on as well (same page as heaptrc.)
Ad Brexinitum (can't help it)

ASerge

  • Hero Member
  • *****
  • Posts: 1130
Re: an Error message appears after mem-leaks message
« Reply #2 on: October 14, 2018, 10:32:50 am »
I tried to make one simple test.
1 stringgrid, 1 button and 1 opendialog.
i just make  procedure:
...
and the error still exist.

Does anyone know why this error message appears?
I did the same and there's no mistake. So either the data is unusual, or you showed us not all the source code, and the error is somewhere out there.

tambok

  • New member
  • *
  • Posts: 12
Re: an Error message appears after mem-leaks message
« Reply #3 on: October 14, 2018, 01:07:45 pm »
I did the same and there's no mistake. So either the data is unusual, or you showed us not all the source code, and the error is somewhere out there.

Hi ASerge,
i dont know, i only created one procedure as a test and simply waited it about 1 minute.

That code should not cause that. Try to compile with line info on as well (same page as heaptrc.)

Hi Taddy, thank you.
with line info, how to do that?

tbk

Thaddy

  • Hero Member
  • *****
  • Posts: 7611
Re: an Error message appears after mem-leaks message
« Reply #4 on: October 14, 2018, 01:22:43 pm »
In lazarus:
Project options --> Compiler Options -->Debugging-->Display line numbers in runtime-error backtracing (-gl)
Ad Brexinitum (can't help it)

ASerge

  • Hero Member
  • *****
  • Posts: 1130
Re: an Error message appears after mem-leaks message
« Reply #5 on: October 14, 2018, 01:25:12 pm »
i dont know, i only created one procedure as a test and simply waited it about 1 minute.
Show the whole source code.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5172
    • wiki
Re: an Error message appears after mem-leaks message
« Reply #6 on: October 14, 2018, 01:44:23 pm »
Do you also get the error, if you run that test app outside the IDE? (or in the IDE, using "run without debugger"?)

tambok

  • New member
  • *
  • Posts: 12
Re: an Error message appears after mem-leaks message
« Reply #7 on: October 14, 2018, 02:05:21 pm »
In lazarus:
Project options --> Compiler Options -->Debugging-->Display line numbers in runtime-error backtracing (-gl)

yes, i did that too.

Show the whole source code.

i tried to upload File, but rejected by restrictions. But i try to upload it again.

Do you also get the error, if you run that test app outside the IDE? (or in the IDE, using "run without debugger"?)


Hi Martin, thanks.
i just run it inside the IDE. unfortunately, if outside the IDE, the result is not appear.


tbk

tambok

  • New member
  • *
  • Posts: 12
Re: an Error message appears after mem-leaks message
« Reply #8 on: October 14, 2018, 02:14:45 pm »
its failed again.

this codes produces same error.

------------------------------

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Grids,
  StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    OpenDialog1: TOpenDialog;
    StringGrid1: TStringGrid;
    procedure Button1Click(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
  filename:String;
begin
  if OpenDialog1.Execute then
   begin
     filename:=OpenDialog1.FileName;
     StringGrid1.LoadFromCSVFile(filename,',',True,0,True);
   end;
end;

end.

.....................

       
« Last Edit: October 14, 2018, 02:16:19 pm by tambok »

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5172
    • wiki
Re: an Error message appears after mem-leaks message
« Reply #9 on: October 14, 2018, 02:27:42 pm »
Do you also get the error, if you run that test app outside the IDE? (or in the IDE, using "run without debugger"?)
i just run it inside the IDE. unfortunately, if outside the IDE, the result is not appear.

Then there may be an explanation.

Some programs (can be any program, text-processing, pdf, zip, ...) install libraries that can cause crashes such as the one you got.
This happens if the install hooks into the window explorer. I.e., they add entries (for certain filetypes) to the explorer context menu, or icons, or other handlers.

As soon as your app uses a file-dialog, those dll will be loaded into the context of your app (because in the open file dialog, you see the files, with icons, and context menu, etc).

Some of those libraries behave different (crash) if they are loaded in an app that is being debugged. Those crashes can happen at different times (after the dialog, at program termination, ...).

See http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#On_Windows_Open.2FSave.2FFile_or_System_Dialog_cause_gdb_to_crash
(the description is a bit similar, but it is related)
Try to set  "DisableLoadSymbolsForLibraries" to "True"  (this will sometimes prevent the issue / not always)

tambok

  • New member
  • *
  • Posts: 12
Re: an Error message appears after mem-leaks message
« Reply #10 on: October 14, 2018, 03:18:53 pm »
Then there may be an explanation.

Some programs (can be any program, text-processing, pdf, zip, ...) install libraries that can cause crashes such as the one you got.
This happens if the install hooks into the window explorer. I.e., they add entries (for certain filetypes) to the explorer context menu, or icons, or other handlers.

As soon as your app uses a file-dialog, those dll will be loaded into the context of your app (because in the open file dialog, you see the files, with icons, and context menu, etc).

Some of those libraries behave different (crash) if they are loaded in an app that is being debugged. Those crashes can happen at different times (after the dialog, at program termination, ...).

See http://wiki.lazarus.freepascal.org/GDB_Debugger_Tips#On_Windows_Open.2FSave.2FFile_or_System_Dialog_cause_gdb_to_crash
(the description is a bit similar, but it is related)
Try to set  "DisableLoadSymbolsForLibraries" to "True"  (this will sometimes prevent the issue / not always)



i have set it, and the result is same.
Any way thank you Martin.


tbk

Thaddy

  • Hero Member
  • *****
  • Posts: 7611
Re: an Error message appears after mem-leaks message
« Reply #11 on: October 14, 2018, 04:36:45 pm »
In this case it may even be the debugger, since the pascal seems to end normally. Try running the compiled program outside the IDE. It should not SIGSEV in that case.
Ad Brexinitum (can't help it)