View Issue Details

IDProjectCategoryView StatusLast Update
0035963LazarusOtherpublic2019-10-10 17:51
ReporterWOTAGamingAssigned ToZeljan Rikalo 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
PlatformWindowsOSWindowsOS Version7, 10
Product Version2.0.4Product Build 
Target VersionFixed in Version 
Summary0035963: Cannot create certain amount of TPortableNetworkGrapic instances
DescriptionI'm developing game that use many PNGs sprites for drawing on TCanvas. I have array of 32 tilelists which are I am cutting into small tiles to 512 from every of them. I have PNGs besides those.
I use TLazIntfImage as intermediary to create and fill PNG object. And upon reaching some certain quantity of sprites inside TPortableNetworkGrapic.LoadFromIntfImage and then TLazIntfImage.CreateBitmaps program raise an silent error 'Failed to create handles'. Silent means application just freezes, but I find error in this point. CreateBitmaps sets new handla as 0.

When I use another method (not cutting pics into sprites and use TCanvas.ClipRect instead of TCanvas.Draw) it works, because I decrease amount of pictures. But this method decreases FPS, so I cant use it everywhere.
Steps To ReproduceTry to create so many PNGs as possible through converting from TLazIntfImage.
TagsPNGImageException
Fixed in Revision
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

WOTAGaming

2019-08-14 12:15

reporter   ~0117668

Last edited: 2019-08-14 12:21

View 2 revisions

I've just tested and found that only 9966 PNGs I can to create.

Testing procedure

procedure TForm1.Button1Click(Sender: TObject);
var
  LImage:TLazIntfImage;
  PNGs:array of TPortableNetworkGraphic;

  i:integer;
begin
 LImage:=TLazIntfImage.Create(0,0,[riqfRGB,riqfAlpha]);
 LImage.SetSize(32,32);

 SetLength(PNGs,0);

 Memo.Lines.Clear;

 while true do
  begin
   SetLength(PNGs,Length(PNGs)+1);
   PNGs[Length(PNGs)-1]:=TPortableNetworkGraphic.Create;

   Memo.Lines.Add(IntToStr(Length(PNGs)));
   Memo.Lines.SaveToFile('q.txt');

   PNGs[Length(PNGs)-1].LoadFromIntfImage(LImage);
  end;
end;

WOTAGaming

2019-10-07 13:13

reporter   ~0118391

OK this is Windows problem. GUI32 limits 10000 handles for gui objects per proccess

Zeljan Rikalo

2019-10-07 18:23

developer   ~0118395

Please close

Issue History

Date Modified Username Field Change
2019-08-14 11:45 WOTAGaming New Issue
2019-08-14 11:51 WOTAGaming Tag Attached: PNGImageException
2019-08-14 12:15 WOTAGaming Note Added: 0117668
2019-08-14 12:21 WOTAGaming Note Edited: 0117668 View Revisions
2019-10-07 13:13 WOTAGaming Note Added: 0118391
2019-10-07 18:23 Zeljan Rikalo Assigned To => Zeljan Rikalo
2019-10-07 18:23 Zeljan Rikalo Status new => resolved
2019-10-07 18:23 Zeljan Rikalo Resolution open => no change required
2019-10-07 18:23 Zeljan Rikalo LazTarget => -
2019-10-07 18:23 Zeljan Rikalo Widgetset Win32/Win64 => Win32/Win64
2019-10-07 18:23 Zeljan Rikalo Note Added: 0118395
2019-10-10 17:51 WOTAGaming Status resolved => closed