?
Solved

Allocate memory for a component

Posted on 2010-11-27
5
Medium Priority
?
402 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 2000 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month8 days, 18 hours left to enroll

764 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