AJAX .NET CollapsiblePanel inside a gridview is causing memory leaks?
One of our ASP.NET pages has a significant memory leak. After a process of manual enable/disabling, I narrowed down the issue to a set of collapsible panels which are dynamically built on the code page and placed into an UpdatePanel which is already on the page.
Using sIEve, I was able to see that this control apparently is creating a large amount of script tags, each having the following form (ignore the sIEve hook attribute):
<SCRIPT type=text/javascript __sIEve_hookedNode="true">Sys.Application.add_init(function() {
$create(AjaxControlToolkit.CollapsiblePanelBehavior, {"ClientStateFieldID":"ctl00_Main_branchPanelExtender_ClientState","CollapseControlID":"ctl00_Main_btnBranchExpander","Collapsed":true,"CollapsedSize":0,"CollapsedText":"* ; ","ExpandControlID":"ctl00_Main_btnBranchExpander","ExpandedSize":100,"ExpandedText":"Collapse","ScrollContents":true,"TextLabelID":"ctl00_Main_btnBranchExpander","id":"ctl00_Main_branchPanelExtender"}, null, null, $get("ctl00_Main_BranchPanel"));});</SCRIPT>
I think this is the problem, but I'm not completely sure. sIEve isn't reporting it as a memory leak, but the DOM nodes are definitely increasing and the page size grows out of control. I'm also not sure what to do about it. My best guess is that the corresponding remove_init isn't being called (or doesn't exist) but I can't find either function call in the AjaxControlToolkit library project.
Has anyone else encountered this problem or have any ideas on how to proceed with fixing it?
Edit: Browser Info This is mainly IE 6, of course, but I also note the issue with FireFox 3. Opera and Chrome don't seem to have the memory leak, but Chrome doesn't render the controls right either.
Further Info: I've noticed a similar problem on another page using HoverMenuExtender. It seems like the DOM just grows each time the UpdatePanel is posted and IE never frees th开发者_如何转开发e memory. Is there maybe a way to catch which items are holding over and manually remove them, or am I being overly cautious and IE will eventually free the memory up if needed?
Well, no answers on this one and I doubt one is coming. The problem can be answered very briefly though as "It's IE6." Sometimes certain DOM elements (the selection elements in an Option tag seem particularly prone) just don't clean up, so they fill the DOM up over time. Nasty, but just another thing to manage in IE6.
精彩评论