Solved

Allocate memory for a component

Posted on 2010-11-27
5
395 Views
Last Modified: 2012-05-10
First, im not sure if this is a generic question or not. I'm using DevArts component "tVitualTable" a table that exist only in memory. If i add 10 000 rows - it takes less than a second, but if i add 100 000 records, it takes about one minute. Im quite sure this has to do with memory allocation, but can i affect this?
0
Comment
Question by:Sunsales
5 Comments
 
LVL 24

Expert Comment

by:jimyX
ID: 34221535
The memory allocation is already done by the component itself and nothing is required from you to help it out.
How do you generate those records, it could be overhead.
Try to duplicate those 10 000 records on memory to make sure it's not memory allocation.
0
 
LVL 14

Expert Comment

by:systan
ID: 34221730
I'm sure the problem is in your loop statement, try to trace each line you have while loading the table
0
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
ID: 34224007
Make sure you call DisableControls and EnableControls.
Dont use FieldByName if you are loading many records, use field index or get pointers to the fields first

procedure TForm1.LoadRecords;
var
  F1: TField;
begin
  F1 := VirtualTable.FieldByName('Field1');
 
  VirtualTable.DisableConrols;
  for I := 0 to LoadCount do
  begin
      VirtualTable.Append;
      FI.AsString := '';
      //or
      VirtualTable.Fields[0].AsString := '';
      VirtualTable.Post;
  end;
  VirtualTable.EnableControls;
end;

Secondly,you dont have to load all the records at once, You can load 10,000 records at a time each time the user scrolls to the last record until you have loaded all records
0
 
LVL 3

Expert Comment

by:gskoczylas
ID: 34224981
Perhaps you don't have enough RAM in your computer. If running applications require to much memory Windows is solving this problem by heavy using of virtual memory (intensively using swap file). In such conditions performance of the whole system drastically decreasing.
0
 

Author Comment

by:Sunsales
ID: 34301233
i got 12 GB ram
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now