Solved

Allocate memory for a component

Posted on 2010-11-27
5
400 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

695 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