Maximum number of components in a ScrollBox (TScrollBox)

180 Views Asked by At

I have developed a program that uses a TScrollBox component to produce a "railway layout". This route is made up of many small figures, each of which represents a single segment of track (according to the idea of railway modeling).

I noticed that for quite small numbers, the software works without problems. But carrying out various debug tests, already with 3500 binaries, it starts to behave in an anomalous way, and with 5000 pieces the program crashes indecently!

I would like to specify that this first version of the software was developed with "Delphi 5 Professional", in the "Windows XP Professional" environment. I thought the problem was the small amount of RAM (3GB maximum), which does not allow you to allocate more than a certain number of pieces, although with a rough estimate I could perhaps have allocated at least 16000 pieces.

I then tried to modify the software to adapt it to "Delphi XE2", in the "Windows 8.1 Professional X64" environment, generating 64-bit code, but the problem described above still occurs.

At this point, I wonder if the problem is to be found in a possible limitation of the TScrollBox component. Is there a maximum number of components that can be placed on the TScrollBox? If so, is there any way to overcome this problem?

1

There are 1 best solutions below

1
On

It is not a limitation of the TScrollBox, but of the OS itself.

A basic limitation imposed by the window manager is that no process can create more than 10,000 USER or GDI objects

Since probably you're using TWinControl descendants, it is most likely you're reaching that limit.