Solved

Allocate memory for a component

Posted on 2010-11-27
5
398 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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:
Ephraim Wangoya 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

730 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