Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

EOutOfResources CopyBitmap

edited December 2008 in General
Hello,

we have the following problem. Our customer are working with Citrix. On
a citrix client machine there are many sessions of our application. As
Printer Driver there are Citrix Universal Printer.

It happens sometimes that the user get the exception EOutOfResources. We
know it happens during the Delphi Method CopyBitmap in Graphics.pas.
It happens only if the user show the report in a preview (not if he
print the report)

We think, that the Printer Driver is the problem.

My collegue has asked why does ReportBuilder use the printer driver for
the preview? He think, that makes no sense.
Can we change this? Is it possible to say the reportbuilder to use not
the default printer driver if the user only want to show the report in
the preview window?

Best wishes
Bernhard

Comments

  • edited December 2008

    For future reference, please always specify Delphi version, ReportBuilder
    version, etc.


    Most common cause of EOutOfResources exception is that the application is
    leaking resources. I recommend running the app under a tool that check for
    memory/resource leaks. AQTime and FastMem are two tools that can be used to
    do this.


    The printer driver is used to perform calculations about the size and
    position of objects, word wrapping, etc. This is required to print
    accurately. It does not use up resources, nor does it do anything with
    bitmaps. To have an accurate Preview of what will be Printed, the printer
    driver should be used to generate the preview.

    If you prefer /not/ to use a printer driver, you can set
    Report.PrinterSetup.PrinterName to Screen. It is one of the items available
    in the drop down list of the object inspector, the Page Setup dialog, or can
    be set via code.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited December 2008
    Thanks for your answer.
    We have all checked and there is definitive no resource leak.
    On the computer where it happens there is in this moment enough free
    memory. It happens always in CopyBitmap.
    Best wishes
    Bernhard

    Here is the exception log :

    date/time : 2008-12-16, 11:19:27, 547ms
    computer name : ISUCTX7
    wts client name : Tuemueklue
    user name : ltuemueklue
    registered owner : ISU / ISU
    operating system : Windows 2003 R2 Service Pack 2 build 3790
    system language : German
    system up time : 9 hours 8 minutes
    program up time : 2 hours 42 minutes
    processors : 2x Intel(R) Xeon(R) CPU E5430 @ 2.66GHz
    physical memory : 1414/3072 MB (free/total)
    free disk space : (C:) 21,14 GB
    display mode : 1280x1024, 24 bit
    process id : $4324
    allocated memory : 56,65 MB
    executable : ZeitarbeitDeluxe.exe
    exec. date/time : 2008-12-15 13:39
    version : 2006.100.0.872
    compiled with : BCB 2006
    madExcept version : 3.0d
    callstack crc : $25948d00, $12535bcf, $fb461c21
    exception number : 4
    exception class : EOutOfResources
    exception message : Für diesen Befehl ist nicht genügend Speicher verfügbar.

    Main ($4328):
    0048fd2b +077 ZeitarbeitDeluxe.exe Graphics 2954
    +4 GDIError
    0048fd63 +007 ZeitarbeitDeluxe.exe Graphics 2961
    +1 GDICheck
    00493caf +117 ZeitarbeitDeluxe.exe Graphics 5467
    +23 CopyBitmap
    0049466f +063 ZeitarbeitDeluxe.exe Graphics 5734
    +9 TBitmap.CopyImage
    00496120 +04c ZeitarbeitDeluxe.exe Graphics 6840
    +10 TBitmap.SetSize
    00495d0b +013 ZeitarbeitDeluxe.exe Graphics 6663
    +1 TBitmap.SetWidth
    00661155 +151 ZeitarbeitDeluxe.exe ppViewr
    TppScreenDevice.CalculateScaledPageSize
    00660d75 +039 ZeitarbeitDeluxe.exe ppViewr
    TppScreenDevice.RenderFullBlankPage
    00660b70 +0a0 ZeitarbeitDeluxe.exe ppViewr
    TppScreenDevice.RenderPage
    00660875 +191 ZeitarbeitDeluxe.exe ppViewr
    TppScreenDevice.ReceivePage
    00668c3d +0c1 ZeitarbeitDeluxe.exe ppDevice
    TppPublisher.TakeDeviceAction
    00668f04 +018 ZeitarbeitDeluxe.exe ppDevice
    TppPublisher.ReceivePage
    006839f2 +016 ZeitarbeitDeluxe.exe ppReport
    TppReport.PageSent
    0063baf1 +015 ZeitarbeitDeluxe.exe ppClass
    TppCustomEngine.DoOnPageSent
    00588042 +1b6 ZeitarbeitDeluxe.exe ppEngine
    TppEngine.SendPage
    00587a66 +172 ZeitarbeitDeluxe.exe ppEngine
    TppEngine.FinishPage
    00586a34 +1b4 ZeitarbeitDeluxe.exe ppEngine
    TppEngine.GeneratePage
    00586b7b +0e3 ZeitarbeitDeluxe.exe ppEngine
    TppEngine.RestorePage
    00586711 +049 ZeitarbeitDeluxe.exe ppEngine
    TppEngine.Generate
    0058660a +0e6 ZeitarbeitDeluxe.exe ppEngine
    TppEngine.RequestPage
    006838cc +0e0 ZeitarbeitDeluxe.exe ppReport
    TppReport.RequestPage
    00669059 +041 ZeitarbeitDeluxe.exe ppDevice
    TppPublisher.DoOnPageRequest
    00668e33 +063 ZeitarbeitDeluxe.exe ppDevice
    TppPublisher.Publish
    0065bd86 +006 ZeitarbeitDeluxe.exe ppProd 1379
    +0 TppProducer.PublishReport
    0065be32 +052 ZeitarbeitDeluxe.exe ppProd 1443
    +10 TppProducer.PrintToDevices
    006837b2 +07e ZeitarbeitDeluxe.exe ppReport
    TppReport.PrintToDevices
    00405566 +002 ZeitarbeitDeluxe.exe System 53
    +0 @ClassDestroy
    0065cae2 +022 ZeitarbeitDeluxe.exe ppProd 2077
    +8 TppProducer.PreviewFormActivateEvent
    004afb27 +00f ZeitarbeitDeluxe.exe ExtCtrls 2281
    +1 TTimer.Timer
    004afa0b +02b ZeitarbeitDeluxe.exe ExtCtrls 2239
    +4 TTimer.WndProc
    00485244 +014 ZeitarbeitDeluxe.exe Classes 11583
    +8 StdWndProc
    0065bf2e +05e ZeitarbeitDeluxe.exe ppProd 1554
    +23 TppProducer.PrintToScreen
    0065bc88 +050 ZeitarbeitDeluxe.exe ppProd 1321
    +12 TppProducer.Print
    006829fa +01e ZeitarbeitDeluxe.exe ppReport
    TppReport.Print
    011b6ae4 +5b4 ZeitarbeitDeluxe.exe ReportAusfuehren 6389
    +94 TFormReportAusfuehren.AusgabeReportBuilder
    011b7df1 +aed ZeitarbeitDeluxe.exe ReportAusfuehren 6563
    +80 TFormReportAusfuehren.AusgabeReport
    00d58af1 +0e9 ZeitarbeitDeluxe.exe SchriftverkehrVorlagenReport 472
    +12 TFrameSchriftverkehrVorlagenReport.AusfuehrenReport
    00d5c490 +104 ZeitarbeitDeluxe.exe SchriftverkehrVorlagenReport 991
    +14 TFrameSchriftverkehrVorlagenReport.ButSchnellansichtClick
    004cbee1 +015 ZeitarbeitDeluxe.exe Controls 5234
    +1 TControl.DblClick
    0069afe4 +038 ZeitarbeitDeluxe.exe DBGrids 3481
    +4 TCustomDBGrid.MouseDown
    004cbf9a +076 ZeitarbeitDeluxe.exe Controls 5252
    +7 TControl.DoMouseDown
    004cc057 +047 ZeitarbeitDeluxe.exe Controls 5276
    +5 TControl.WMLButtonDblClk
    004cb9bf +2bb ZeitarbeitDeluxe.exe Controls 5146
    +83 TControl.WndProc
    004cfa0b +4fb ZeitarbeitDeluxe.exe Controls 7304
    +111 TWinControl.WndProc
    004cf134 +02c ZeitarbeitDeluxe.exe Controls 7073
    +3 TWinControl.MainWndProc
    00485244 +014 ZeitarbeitDeluxe.exe Classes 11583
    +8 StdWndProc


    Nard Moseley (Digital Metaphors) schrieb:
  • edited December 2008
    Delphi 2007, RB 10.06, Windows 2003

    Bernhard Roos schrieb:
  • edited December 2008

    Try using the Delphi debugger to trace into
    TppScreenDevice.CalculateScaledPageSize. That method is using the Zoom
    precentage to calculated the size of a bitmap called FPageImage. The size is
    calculated in screen pixels.

    Try creating a very simple test application - a trivial report. And then
    test to see whether that encounters the issue.

    If this only happens on Citrix, then I would look to Citrix as the cause of
    the issue. We have customers that use Citrix successfully, so it should be a
    matter of getting things configured properly. Perhaps there is a limit to
    how much memory each client app can use. Make sure in your Delphi project
    you do not use auto-create forms and create/destroy forms efficiently to
    conserve resource.




    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
    x

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited January 2009
    Now we know, that the reason is CreateCompatibleBitmap. In a simple
    testapplication I'm creating with citrix many bitmaps with 256*256
    pixel. On Citrix I'm only able to create 141 bitmaps. If I'm creating
    bitmaps which are bigger (the reportbuilder creates bitmaps for the
    preview with 926*1280), than I can more less bitmaps create.

    Do anybody know if Citrix the memory for bitmaps/graphics is limiting?
    The support of citrix has so far no idea. But if I don't use citrix but
    Remote Desktop, I'm able to create much more bitmaps.

    Best wishes
    Bernhard

    Nard Moseley (Digital Metaphors) schrieb:
  • edited January 2009
    Now we have the solution. Citrix simulates the graphic memory. But for
    each session there is only 32 MB.
    We solved the problem that the user can set the color depth only to
    16bit (not to 24 bit).
    Best wishes
    Bernhard

    Bernhard Roos schrieb:
This discussion has been closed.