ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Error: MIO.Acquire and FastMM
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

madas

Germany
21 Posts

Posted - Dec 11 2017 :  10:02:10  Show Profile  Reply
Hi,

I am getting the following error from FastMM when I try to scan TIF-files via TImageEnMView. Delphi 2009, FastMM 4.991 und ImageEn 7.0.0.1



stacklist:


Fehlermeldung:
Zu wenig Arbeitsspeicher
--------------------------------------------------------------------------
--
Exception class: EOutOfMemory
Exception Adresse: 00404A93
--------------------------------------------------------------------------
--
Stackliste, generiert 11.12.2017 16:00:29 [00404A8E] System.TObject.NewInstance + $A [00403756] System.ErrorAt + $16 [00404A8E] System.TObject.NewInstance + $A [00404FDF] System.@ClassCreate + $7 [00A40552] iexBitmaps.TIOParams.Create (Line 42125, "iexBitmaps.pas" + 0)
+ $A
[00A47C8B] iexBitmaps.TIOMultiParams.CheckAllocated (Line 50603, "iexBitmaps.pas" + 4) + $9 [00A47F3C] iexBitmaps.TIOMultiParams.GetParams (Line 50699, "iexBitmaps.pas" + 4) + $4 [00991B0D] iemio.TImageEnMIO.LoadFromStreamTIFF (Line 1645, "iemio.pas" +
19) + $C
[00436B5D] Classes.THandleStream.Create + $19 [0040504D] System.@AfterConstruction + $1D [009919F0] iemio.TImageEnMIO.LoadFromFileTIFF (Line 1596, "iemio.pas" + 5)
+ $6
[009925F1] iemio.TImageEnMIO.LoadFromFile (Line 2140, "iemio.pas" + 27) +
$5
[00992453] iemio.TImageEnMIO.LoadFromFile (Line 2099, "iemio.pas" + 22) +
$6



I am using the following code:


unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, hyieutils, iexBitmaps, hyiedefs, iesettings, iexLayers, iexRulers, StdCtrls, ieview, iemview, fraImageIE,
  FileCtrl, ComCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    FrameImgIE1: TFrameImgIE;
    ListView1: TListView;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ListView1SelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
  private
    currCount: Integer;
    procedure ImageEnMView1AfterAcquireBitmap(Sender: TObject; index: Integer);
  public
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.Button1Click(Sender: TObject);
begin
  currCount := 0;
  with FrameImgIE1.ImagePreview.MIO do
  begin
    TwainParams.ShowSettingsOnly   := False;
    TwainParams.ProgressIndicators := False;
    TwainParams.VisibleDialog      := false;
    TwainParams.FeederEnabled      := true;
    Acquire;
  end;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
  FrameImgIE1.ImagePreview.MIO.OnAfterAcquireBitmap := ImageEnMView1AfterAcquireBitmap;
end;

procedure TForm2.ImageEnMView1AfterAcquireBitmap(Sender: TObject; index: Integer);
var
  item: TListItem;
begin
  Inc(currCount);
  ListView1.AddItem('D:\tempImage_' + Format('%.3d', [currCount]) + '.tif', nil);
  item := ListView1.Items[ListView1.Items.Count - 1];
  FrameImgIE1.ImagePreview.MIO.Params[index].TIFF_Compression := ioTIFF_G4FAX;
  FrameImgIE1.ImagePreview.MIO.Params[index].BitsPerSample := 1;
  FrameImgIE1.ImagePreview.MIO.Params[index].SamplesPerPixel := 1;
  FrameImgIE1.ImagePreview.MIO.SaveToFileTIFF(item.Caption);
  FrameImgIE1.ImagePreview.Clear;
end;

procedure TForm2.ListView1SelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
begin
  FrameImgIE1.LoadImage(Item.Caption);
end;

end.


If I comment out the FastMM unit then all seems to work correctly.

Any clue on this error???

Greetings.

madas

xequte

38219 Posts

Posted - Dec 11 2017 :  13:29:17  Show Profile  Reply
Hi Madas

On what line does it occur in your source (or is it after the end of ImageEnMView1AfterAcquireBitmap)?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

madas

Germany
21 Posts

Posted - Dec 12 2017 :  01:36:07  Show Profile  Reply
Hi Nigel,

the scan process ends at the end of the first page and no other page is scaned. For what I could find all went well until the code is reaching line 2051 of the unit imscan.pas


if IOParams <> nil then
      begin
        case twImageInfo.BitsPerPixel of
          1..8:
            begin
              IOParams.BitsPerSample := twImageInfo.BitsPerPixel;
              IOParams.SamplesPerPixel := 1;
            end;
          24:
            begin
              IOParams.BitsPerSample := 8;
              IOParams.SamplesPerPixel := 3;
            end;
        end;
        IOParams.DpiX := ImDpiX;
        IOParams.DpiY := ImDpiY;
        IOParams.Width := twImageInfo.ImageWidth;
        IOParams.Height := twImageInfo.ImageLength;
        IOParams.OriginalWidth := twImageInfo.ImageWidth;
        IOParams.OriginalHeight := twImageInfo.ImageLength;
        IOParams.FreeColorMap;
        IOParams.FileName := fCaption;
      end;


Hope this helps.

madas
Go to Top of Page

madas

Germany
21 Posts

Posted - Dec 12 2017 :  01:38:17  Show Profile  Reply
The stacktrace above is from an exception I getting after clicking on the first created listview item.
Go to Top of Page

madas

Germany
21 Posts

Posted - Dec 12 2017 :  01:41:49  Show Profile  Reply
Attached please find the test project.

attach/madas/2017121214131_MioLoadErrorTest.zip
348 KB

The exception dialog component is not include. So has to be removed from the form.
Go to Top of Page

madas

Germany
21 Posts

Posted - Dec 12 2017 :  02:01:14  Show Profile  Reply
Hi Nigel,

I was assuming the latest version of FastMM was the 4.991. I had another search for the project homepage and found that it was moved the github instead of sourceforge. At github there was a newer version 4.992 which resolved the problem for me.

greetings.

madas
Go to Top of Page

madas

Germany
21 Posts

Posted - Dec 12 2017 :  02:15:36  Show Profile  Reply
More research:

The error is caused by the fulldebugmode of FastMM. I have no idea why?.

greetings.

madas
Go to Top of Page

xequte

38219 Posts

Posted - Dec 14 2017 :  17:42:25  Show Profile  Reply
Hi Madas

So, to clarify, it works correctly with the newer version of FastMM?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: