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
4165
Out of Memory with Icons?
posted

I have a tree that I am generating that can possibly generate 1000's of nodes. Each node has an icon and text.

In situation where I have a couple of hundred, no problem. When I get into the 1000's, I get 'Out Of Memory' errors. If I take out the icons, no issue.

Not sure where to start with this, but I have an imagelist with 16x16 icons...png's. (Very small)

Here is an example of how I am generating certain levels of the tree:

UltraTreeNode worknode = null;

public void GenerateDash(UltraTree tv)

{

worknode = tv.GetNodeByKey(SQLReader.GetString(21) + SQLReader.GetInt32(24));
if (worknode == null)
{
if (sid)
   worknode = tv.Nodes[SQLReader.GetInt32(24) + "mc"].Nodes.Add(SQLReader.GetString(21) + SQLReader.GetInt32(24), SQLReader.GetString(21));
     else
   worknode = tv.Nodes["me"].Nodes[SQLReader.GetInt32(24) + "emp"].Nodes[SQLReader.GetInt32(24) + "mc"].Nodes.Add(SQLReader.GetString(21) + SQLReader.GetInt32(24), SQLReader.GetString(21));
worknode.LeftImages.Add(tv.ImageList.Images[12]);
 }
if (tv.GetNodeByKey(SQLReader.GetString(21) + SQLReader.GetInt32(24) + SQLReader.GetString(22)) == null)
 {
 worknode = worknode.Nodes.Add(SQLReader.GetString(21) + SQLReader.GetInt32(24) + SQLReader.GetString(22), SQLReader.GetString(22));
 worknode.LeftImages.Add(tv.ImageList.Images[35]);
}
else
 worknode = tv.GetNodeByKey(SQLReader.GetString(21) + SQLReader.GetInt32(24) + SQLReader.GetString(22)); 

}

Before this I had a standard .net tree which generated the same amount of nodes with the icon with no issue.

 

Thanks.

 

 

 

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi,

    What version of the tree are you using?

    You might want to try specifying an index to the LeftImages collection instead of an image.

    For example, you could do this:

    worknode.LeftImages.Add(12);

    This will work the same as what you have now, assuming that you have set the tree's ImageList property to your tv.ImageList. This also assumes that you are only using one ImageList for all of your images.

    If that does not help, then we would need to look into this further. How many different images do you have? I assume you don't have thousands of images, but you are probably re-using the same set of images for multiple nodes.

    If you could provide a small sample project demonstrating the issue, we would be happy to take a look.

Reply Children