Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
290
MyUltraTree.ResetNodes or MyUltraTree.Nodes.Clear? Memory piles up..
posted

Hello all,

I have an unbound UltraTree (v16.1) which is populated using the code below. This works well. Yet, my RAM piles up each time i populate the tree. I guess that the GC is not firing. Which is the right way to "clean" alle nodes off the tree to refill it with new data, using the same columnset as before? resetNodes or Nodes.Clear? According to help, both "remove all nodes".. but not from RAM?

Thanks

Martin

int intMinLevel = dstTreeBuilder.MyHierarchy.Min(r => r.cteLevel);

int intMaxLevel = dstTreeBuilder.MyHierarchy.Max(r => r.cteLevel);

utrMyHierarchy.BeginUpdate();

utrMyHierarchy.Nodes.Clear();

utrMyHierarchy.ResetNodes();

UltraTreeNode node;

//generate nodes by Level (first root, then children of root etc)

for (int intCurrentLevel = intMinLevel; intCurrentLevel <= intMaxLevel; intCurrentLevel++)

{

var CurrentLevelRows = dstTreeBuilder.MyHierarchy.Where(r => r.cteLevel == intCurrentLevel).OrderBy(r => r.ID);

foreach (var CurrentLevelRow in CurrentLevelRows)

{

 node = new UltraTreeNode(CurrentLevelRow.ID.ToString(CultureInfo.InvariantCulture));

node.Override.ColumnSet = oColumnset;

 foreach (UltraTreeNodeColumn col in oColumnset.Columns)

{

node.SetCellValue(col, CurrentLevelRow[col.Key]);

}

//Place Node in hierarchy

if (intCurrentLevel == intMinLevel)

{

//Root

utrMyHierarchy.Nodes.Add(node);

}

else

{

//Non-Root

UltraTreeNode parentNode = utrMyHierarchy.GetNodeByKey(CurrentLevelRow.F_Parent_ID.ToString(CultureInfo.InvariantCulture));

parentNode.Nodes.Add(node);

}

}

}

utrMyHierarchy.EndUpdate();

Parents Reply Children
No Data