Fastreport 6.7.1 - memory leak on pictures

HI

Our ERP has built-in as reporttool Fastreport 6.7.1.

We build our own reports.

We have a report with big pictures in them, these pictures are loaded from hard disk.

As soon as we load the picture you can see memory increasing rapidly, but it does not seem to get released again.

The code we use:


sub Picture3OnBeforePrint(Sender)

    var

    maxWidth = "700"

    maxHeight = "960"

    string:MyLink1

    TfrxPictureView:cPicture3

    MyLink1=(<C1019_2DC1."DocumentAfbeelding">)

    cPicture3 = TfrxPictureView.Create(nil)

     cPicture3.Picture.LoadFromFile(MyLink1)                        --> memory increases here a lot  

    Picture3.Picture=cPicture3.Picture

    if   cPicture3.Picture.Width > maxWidth then

        Sender.Visible=True

        Sender.Width = maxWidth

        Sender.Height=(cPicture3.Picture.Height)/(cPicture3.Picture.Width) * maxWidth

    end if

    if   (cPicture3.Picture.Height > maxHeight) and (cPicture3.Picture.Height > cPicture3.Picture.Width) then

        Sender.Visible=True

        Sender.Height = maxHeight

        Sender.Width=(cPicture3.Picture.Width)/(cPicture3.Picture.Height) * maxHeight

    end if

    if   (cPicture3.Picture.Width <= maxWidth) and (cPicture3.Picture.Height <= maxHeight) then

        Sender.Width = cPicture3.Picture.Width

        Sender.Height = cPicture3.Picture.Height

    end if

end sub


If I put a showmessage before and after de LoadFromFile then we can see where the increase of memory is coming from.


But why does it not get released ?


Is there anything I can put in the code to get the memory released ?

Is there any documentation on the TfrxPictureView object ?


Thank you

Comments

  • gpigpi Volnovakha, Ukraine

     Use cPicture3 = TfrxPictureView.Create(nil) one time only, not for each Picture3OnBeforePrint

  • Thx I will try it

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.