Forum > LCL

Limit to number of cells in stringgrid in wince

(1/1)

polypress:
I understand from other sources that lazarus may commit a default amount of memory to each cell in a stringgrid. Is there any way to control this amount of memory (by cell or by column). I have 500,000 cells which require data from various files, some of which only need 1, 2, 4, 5 or 10 characters of data, while others need up to 30 characters (in the longer term, with new sources of data, this will need to increase to 60 characters). Currently, the applications crash when more than 300,000 cells are used. If I use more data but in fewer cells, the programs do not crash, suggesting that the default cell memory allocation may be true.

Any ideas?

I have tried using kgrids, but that will not install in my latest version of lazarus (0.29).

Regards

JuhaManninen:
How long does it take to fill those 300 000 cells? I guess it takes a long time.
Is there any error message before the crash?
"wince" - are you doing this in some resource limited pocket machine?

I am afraid you will not get good performance using TStringGrid.
Try VirtualTreeView instead! It works as a flat table as well.
It is extremely fast. Adding 500000 nodes happens in "no time" and data is fetched on-demand by event handlers.

I have a nice optimized in-memory DB for both table- and tree-data, connecting to VirtualTreeView, but I haven't yet published it. If you are interested please tell me.

Juha

JD:
VirtualTreeView is what you need. I seen it handle 1000000 rows at breathtaking speeds.

I would however advise you to revisit the design of your application. Ask yourself the following questions

Do the users need to interact with 300000 rows in a grid at the same time?

How fast will data retrieval be on a network if users are connected to a network?

In addition to using VirtualTreeView, I suggest you look into the idea of data paging. Here instead of retrieving all 300000 rows, retrieve say the first 100 rows & give users the option of retrieving the next 100 rows & so on (i.e browsing through the dataset 100 rows at a time). Your application will be faster & look modern since this is the same principle that web searching uses.

Cheers & good luck,

 :D

jesusr:

--- Quote from: polypress on September 10, 2010, 09:38:53 am ---I understand from other sources that lazarus may commit a default amount of memory to each cell in a stringgrid. Is there any way to control this amount of memory (by cell or by column). I have 500,000 cells which require data from various files, some of which only need 1, 2, 4, 5 or 10 characters of data, while others need up to 30 characters (in the longer term, with new sources of data, this will need to increase to 60 characters). Currently, the applications crash when more than 300,000 cells are used. If I use more data but in fewer cells, the programs do not crash, suggesting that the default cell memory allocation may be true.

Any ideas?

I have tried using kgrids, but that will not install in my latest version of lazarus (0.29).

Regards

--- End quote ---

can you prepare or make available a test application in order to see what can be made?.  If you have your data already in some data structure you may want to use TDrawGrid instead of TStringGrid.

Navigation

[0] Message Index

Go to full version