-
Content Count
8 -
Joined
-
Last visited
Community Reputation
0 NeutralRecent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
-
I Did not know that. Now, I am completly lost, I just try to make an new application that create components to understand the gdi use. Conclusion : - TButton = 5 GDI - TBitBtn = 0 GDI - TSpeedButton = 0 GDI - TImage = 0 GDI - TVirtualImage = 0 GDI - TImageList / TVirtualImageList (with 100 Bitmap inside) = 5 GDI My conclusion is that I am going to try to convert all my tbutton in BitBtn...(with a software of course).
-
Thanks for your help. I have made a ticket for TMS support, because even their sample use 500 GDI for a minimal Ribbon. I have no ressource leak in my software (I use MadExcept ressource leak to check). I create frames and forms on the fly, but I don't free them, because it is slow to create, and the user can wait 1 time to open a window, but not each time it click on the button. That's why, while usin,g the software, the number of GDI objet increase. I have tried Deleaker to check GDI leak, but my project is too big and it freeze after some minutes of usage. The main problem is the Ribbon, add a button to the ribbon use 17 GDI Objects ! (Even in sample application). But I have begun to reduce GDI usage in the remaining of the software by moving imagelist present in frames instancied several times, to a datamodule. Thanks again
-
Hello, We have a big problem with the window limitation of GDI Objects (10 000 by process). Our software is big (5 000 000 lines), and use a lot of TImage, TImageList, old Bitbtn and speedbutton, etc... But We use lazy initialization pour each frame and form (we create them when needed). 3 monthes ago, we have decided to modernize the GUI, and we have used the TMS Ribbon. After that, the software as begin to be instable (out of ressource, random error on imagelist, on canvas, ...) very quickly. I have checked the number of GUI Objects, and I have discover that : - TMS Ribbon use more than 5000 GDI objects for an interface of only a dozen of tabs (and related ribons) !!!!!! - VirtualTreeView (we have more near 100 virtual TreeView in our GUI) use about 100-200 GDI objects by tree !!!! (even if using virtualImageList). We have no time to allow to change TMS Ribbon for another component. I imagine two solutions : - Destroy Virtual Tree View when there are not visible et recreate them when I need them, but, it will be a big work. - Increase the window limit by process (10 000) of GDI objects by changing automatically the value in the registry for each user (more than 2000). My questions are : - Is it really dangerous to increase the Windows limit to about 16 000 by process instead of 10 000 for thousand of users ? - Do you have any other suggestion to decrease this number ? Thanks a lot for your answers, we are in ermegency as we have to deliver the new version of our software in a few weeks (Shame on me 😞 )
-
I have made the test multiple times, with exactly the code I have posted and I have always the same result. I use Delphi 10.4, perhaps, there is a difference in the code generated.
-
Here is a small example. Just a form with a button. The array is not a local variable and the allocation is done before measuring time. On my PC : - 24 seconds with static array - 27 seconds with dynamic array. unit Unit1; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; Const NbPrime = 10000000; Type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } // Table: Array [0 .. NbPremier] of Dword; Table: Array of Dword; end; var Form1: TForm1; implementation uses math; {$R *.DFM} procedure TForm1.Button1Click(Sender: TObject); var current, first, last: Dword; IsPrime: Boolean; index: Dword; sqcompteur: Dword; StartTime, EndTime: TTime; i, j: Dword; BEGIN SetLength(Table, NbPrime); StartTime := Time(); Table[0] := 2; Table[1] := 3; last := 1; index := 5; while last < NbPrime do begin sqcompteur := trunc(sqrt(index)) + 1; IsPrime := True; current := 1; while IsPrime and (Table[current] < sqcompteur) do begin IsPrime := (index mod Table[current]) <> 0; current := current + 1 end; if IsPrime then begin last := last + 1; Table[last] := index; end; index := index + 2; end; EndTime := Time(); StartTime := EndTime - StartTime; showMessage(TimeToStr(StartTime)); end; end.
-
A gem from the past (Goto)
Heremik replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
I use "break" unstead of "goto" in a loop. With an additionnal boolean to manage double loop. And I use try finaly to be sure to liberate memory that I have reserved. Of course, Try finaly must not be used in time critical procedure. -
Thank's for the advice if it is possible.
-
Heremik changed their profile photo
-
Hello, I work with Delphi from the begining (even begun with turbo pascal). I have to make calculation with very big array. if I use dynamic array no problem for the size. But dynamic array are very slow vs static array (about at least 2X). So my intention was to use static array to perform my objective. But, i have a problem. When I try a clean VCL projet and I declare that : Table : array[0..536870473] of integer; => Ok Table : array[0..536870474] of integer; => Access violation (74 to 76) Table : array[0..536870477] of integer; => Compilation error, data too big > 2Go... I have tried with boolean : Table: array [0 .. 2147481895] of Boolean; => Ok Table: array [0 .. 2147481896] of Boolean; => Access violation (896 to 911) Table: array [0 .. 2147481911] of Boolean => Compilation error, data too big > 2Go... Ok, Access violation is just an error to the limitation. But in 64 bits why limitation to 2 Go ??????? I have 80 Go of RAM on my computer, and I don't understand why my static array are limited. Is there a solution ? (with performance, because I always need speed).