Ask a Question

UltraGrid using too much memory

hiepwork08
Contributor

UltraGrid using too much memory

I am testing a desktop application where I need to access the ultragrid object.

As part of the test I need to loop through the grid to get cell objects:

 

I have the following lines of code:

 

while (!TableList.IsEOF())

{

  actual_Item = Grid.Rows.Item(i).Cells.Item(ColumnIndex).Value.OleValue;

  expected_Item = TableList.Value(TableColName);

}

 

Through tests, I am finding that the line:

 

actual_Item = Grid.Rows.Item(i).Cells.Item(ColumnIndex).Value.OleValue;

 

is using up a lot of memory as such that it causes test complete to crash.

 

2 REPLIES 2
shankar_r
Community Hero

while (!TableList.IsEOF())

{

  actual_Item = Grid.Rows.Item(i).Cells.Item(ColumnIndex).Value.OleValue;

  expected_Item = TableList.Value(TableColName);

}

 

In the above code, where are you incrementing i ?. which looping on the same which might be the reason for TestComplete to crash.

You have to change your code like below.

 

var i = 0;
while (!TableList.IsEOF())

{

  actual_Item = Grid.Rows.Item(i).Cells.Item(ColumnIndex).Value.OleValue;

  expected_Item = TableList.Value(TableColName);
  i++;
}

 

 

 


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

I only included a snippet of code to illustrate my problem.

But you are right, for the while loop to work it needs the i increment and the advancement of the table iterator, i.e

TableList.Next...

cancel
Showing results for 
Search instead for 
Did you mean: