动态生成控件的内存用法 [英] MEMORY USAGES for dynamically generated controls

查看:59
本文介绍了动态生成控件的内存用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.......
我对asp.net中动态生成的控件的内存使用情况毫不怀疑.我正在尝试使用clientidmode static在pageload上生成链接按钮.在生成每个页面加载控件时,我的问题是
1.每次新的内存分配是否发生?
2.由于生成了新的likns按钮,我的Web应用程序的内存使用量是否增加了?
3.现有控件是否被新控件覆盖?
4.可以在每个页面加载时为相同的控件生成动态控件还是在有条件的可见性下使用静态控件,这很好吗?
5.如果生成了新控件,那么如果我已将clientIdmode声明为static,为什么不存在id冲突?
6.现有控件是否在每个页面加载时删除或未加载?

hi.......
i have little doubt regarding memory usages for dynamically generated controls in the asp.net.I am trying to generatde links buttons on pageload with clientidmode static.on each page load controls are generated my question is
1.each time new memory allocation is happend or not?
2.is there memory usage of my web app increases due to new generated likns buttons?
3.existing controls overwrite with new one or it not?
4.is it fine with go with dynamic control generation for same controls on each page load or use static control where visibility is conditionally?
5.if new control generated then why not there id''s conflict if i have declared clientIdmode static?
6.existing controls deleted or not on each page load?

推荐答案

1)是.
2)也许.可能不是,因为应用运行时会分配默认大小的内存.在用尽之前,您将不再使用任何内存.
3)号
4)依赖-如果您总是分配相同数量的控件,那么我将静态分配它们-在项目上工作时,很容易看到正在发生的事情.如果要根据(例如)数据库信息来创建它们,那么动态方法就是可行的方法.
5)在这里不明白你的问题.
6)是,除非是回发.
1) Yes.
2) Maybe. Probably not, as there is a default sized chunk of memory allocated when you app runs. Until this is exhausted, you won''t use any more memory.
3) No.
4) Depends - If you are always allocating the same number of controls, then I would allocated them statically - it''s easier to see what is happening when you work on the project. If you are creating them as a result of (for example) database information, then dynamic is the way to go.
5) Don''t understand your question here.
6) Yes, unless it is a postback.


这篇关于动态生成控件的内存用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆