简体   繁体   English

Windows Treeview控件中的最大项目数? 棒球场?

[英]Maximum number of items in a windows treeview control? Ballpark?

MSDN Says: MSDN说:

A tree-view control uses memory that is allocated from the heap of the process that creates the tree-view control. 树视图控件使用从创建树视图控件的进程的堆中分配的内存。 The maximum number of items in a tree view is based on the amount of memory that is available in the heap. 树状视图中的最大项目数基于堆中可用的内存量。

So, anecdotally or otherwise, can someone give me a ballpark of what this means? 因此,无论是轶事还是其他方式,有人可以给我一个大概的含义吗? I expect the stuff I'm doing in a treeview will be limited to < 1000 items for most cases but in some cases closer to 10000. 我预计在大多数情况下,我在树状视图中所做的工作将限制为<1000个项目,但在某些情况下接近10000个。

You can find some (limited) info about tree view memory usage and how to minimize it in this Knowledge Base article: http://support.microsoft.com/kb/130697 您可以在此知识库文章中找到有关树视图内存使用情况以及如何将其最小化的一些(有限)信息: http : //support.microsoft.com/kb/130697

(Note the info about 40 bytes is probably valid for 32-bit application, for 64-bit it is probably a bit more.) (请注意,有关40字节的信息可能对32位应用程序有效,而对于64位信息则可能更多。)

It means exactly as it says, the addition of treeview nodes will consume memory (reference objects that are placed on the heap) and the more you add the more it will consume. 确切地说,添加树视图节点将消耗内存(放置在堆上的引用对象),添加的树数量越多,消耗的内存就越多。 For your particular circumstance approx 10,000 I dont think memory will be a great issue for most modern day computers. 对于您的特定情况,大约10,000我不认为内存对于大多数现代计算机来说不是一个大问题。

With large trees the best way I have found to deal with the loading of the tree is to load a nodes children only when the user expands the node - Loading on demand. 对于大型树,我发现处理树的加载的最佳方法是仅在用户扩展节点时加载子节点(即按需加载)。 This will save loading too many unnecessary nodes and hence reduce the amount of memory required. 这将节省加载太多不必要的节点,从而减少所需的内存量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM