Forum Discussion

hiepwork08's avatar
hiepwork08
Contributor
6 years ago

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

  • shankar_r's avatar
    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++;
    }

     

     

     

    • hiepwork08's avatar
      hiepwork08
      Contributor

      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...