digao-dalpiaz / DzHTMLText

Delphi and Lazarus HTML Label component
MIT License
194 stars 53 forks source link

Out of resources #60

Closed NORECS closed 10 months ago

NORECS commented 3 years ago

I've no idea what is happening but maybe it's DzHTMLText related?

Could be that doing few hours of repainting once per second leads to "Out of resources".

I have reportmemleaksonshutdown = true, and I don't get anything, but not sure if memory leaks from thread I have are reported.

Will try with madExcept turned on, maybe I'll get more info, but not sure I have enough time for another loop until tomorrow.

This is the call stack that made me think it could be related.

:754d46d2 KERNELBASE.RaiseException + 0x62
Vcl.Graphics.OutOfResources
Vcl.Graphics.GDIError
Vcl.Graphics.GDICheck(0)
Vcl.Graphics.CopyBitmap(0,0,0,$19F70C,nil)
Vcl.Graphics.TBitmap.CopyImage(0,0,((0, 3832, 2001, 0, 0, 0, nil), (0, 3832, 2001, 0, 0, 0, 0, 0, 0, 0, 0), (0, 0, 0), 0, 0))
Vcl.Graphics.TBitmap.SetSize(???,???)
Vcl.DzHTMLText.TDzHTMLText.DoPaint
Vcl.DzHTMLText.TDzHTMLText.Paint
Vcl.Controls.TGraphicControl.WMPaint(???)
Vcl.Controls.TControl.WndProc((15, 1174475909, 0, 0, 5253, 17921, (), 0, 0, (), 0, 0, ()))
Vcl.Controls.TControl.Perform(???,???,0)
Vcl.Controls.TWinControl.PaintControls(1174475909,???)
Vcl.Controls.TWinControl.PaintHandler((15, (), 0, 0, 0))
Vcl.Controls.TWinControl.WMPaint((15, (), 0, 0, 0))
Vcl.Controls.TControl.WndProc((15, 0, 0, 0, 0, 0, (), 0, 0, (), 0, 0, ()))
Vcl.Controls.TWinControl.WndProc((15, 0, 0, 0, 0, 0, (), 0, 0, (), 0, 0, ()))
Vcl.Controls.TWinControl.MainWndProc(???)
System.Classes.StdWndProc(7014178,15,0,0)
:76d747ab USER32.AddClipboardFormatListener + 0x4b
:76d552ac ; C:\WINDOWS\SysWOW64\USER32.dll
:76d54e4a ; C:\WINDOWS\SysWOW64\USER32.dll
:76d5e4cf ; C:\WINDOWS\SysWOW64\USER32.dll
:7755537d ntdll.KiUserCallbackDispatcher + 0x4d
:76d541e0 USER32.DispatchMessageW + 0x10
Vcl.Forms.TApplication.ProcessMessage(???)
NORECS commented 3 years ago

Here's an interesting thread https://stackoverflow.com/questions/2180345/hunting-down-eoutofresources

NORECS commented 3 years ago

I ran my program today > 4 hours, at least twice as long as before, without running out of resources. Only difference is I haven't clicked any links. So that may be related.

digao-dalpiaz commented 3 years ago

Are you using Thread or Application.ProcessMessages in your app?

It could be a problem with internal canvas control.

digao-dalpiaz commented 3 years ago

I made a fix to lock the canvas when painting the control. Please test your environment to see if any changes result.

Download the changes using this branch: https://github.com/digao-dalpiaz/DzHTMLText/tree/paint-out-of-res

digao-dalpiaz commented 2 years ago

Hello!

@NORECS, are you still having this problem ?

digao-dalpiaz commented 1 year ago

Please, read this information about the same error: https://stackoverflow.com/questions/24013287/drawing-transparent-message-to-screen-gives-out-of-system-resources

Maybe you are docking the component, and in a specific case, the bounds (Width and Height) became negative, so that error will raise.

This problem occurs in VCL environment because we are using an internal Bitmap to draw component image:

  B := TBitmap.Create;
  try
    B.SetSize(Width, Height);
    CanvasProcess(B.Canvas);
    Canvas.Draw(0, 0, B);
  finally
    B.Free;
  end;
digao-dalpiaz commented 11 months ago

Hello @NORECS , Are you still having this problem with the component?

digao-dalpiaz commented 10 months ago

Closing this issue as there was no response.