Javascript Prime面临性能问题
目前正在使用Primefaces 3.4.2,我们注意到,如果您使用ajax浏览我们的应用程序,而不重新加载页面,那么我们将开始使用大量内存。目前,我们正在使用一个名为“分析firefox内存”的程序,并注意到我们保存了很多僵尸dom对象。缩小范围以聚焦于由以下primefaces selectBooleanCheckbox创建的一个对象Javascript Prime面临性能问题,javascript,jquery,jsf,primefaces,Javascript,Jquery,Jsf,Primefaces,目前正在使用Primefaces 3.4.2,我们注意到,如果您使用ajax浏览我们的应用程序,而不重新加载页面,那么我们将开始使用大量内存。目前,我们正在使用一个名为“分析firefox内存”的程序,并注意到我们保存了很多僵尸dom对象。缩小范围以聚焦于由以下primefaces selectBooleanCheckbox创建的一个对象 <p:selectBooleanCheckbox id="compareChkbx" value="#{cc.attrs.xProd.selec
<p:selectBooleanCheckbox id="compareChkbx"
value="#{cc.attrs.xProd.selected}" styleClass="selectBooleanCheckbox"
rendered="#{dto.size > 1}" >
<p:ajax event="change" oncomplete="radioButtonSelected()"
listener="#{compareBean.onClickCompare(cc.attrs.xProd, cc.attrs.dto.partTerminology.partTerminologyId)}" update=":hform:lookupResults:pageInfo :hform:compareProducts:compareGroup @this" process="@this" />
</p:selectBooleanCheckbox>
我注意到的另一件事是,在浏览应用程序一段时间后,我在firebug脚本选项卡中找到了hundredsjavax.faces.resource/jquery/jquery.js.xhtml?ln=primefaces/eval/seq/xx
我认为有一个未被释放的侦听器连接到由
p:selectBooleanCheckbox
创建的div,我只是想知道如何在使用ajax重新加载页面的该部分后释放该对象。关于使用PrimeFaces时内存泄漏的一些讨论。“拜耳dba”在PrimeFaces社区论坛上发布了这个问题:
这导致了近一年前的错误报告和补丁提交:
我认为这个补丁还没有进入主干,但是如果你看一下代码,你会发现它在每个小部件中添加了一个dispose()方法,以便在删除小部件时清除小部件资源
您可能会发现,应用此修补程序可以改善与僵尸DOM元素相关的情况。
另外,我注意到补丁在清除资源时引用了“PrimeFaces.widgetCache”,因此您可以在脚本中尝试类似的内容:
删除PrimeFaces.widgetCache[id]
_Pez提供的第一个链接显示了难以置信的自我研究和调试能力+对于你的答案,我也希望我能把它给拜耳dba在PF论坛上的任何人。
FragmentOrElement (xhtml) input id='lookupResults:CatResultList:0:aapPartType:list-by-cat:22:aapProd:aapProd:compareChkbx_input' http://localhost:8080/epcfe-web/main.xhtml
JS Object (HTMLInputElement)
FragmentOrElement (xhtml) div class='ui-helper-hidden-accessible' http://localhost:8080/epcfe-web/main.xhtml
FragmentOrElement (xhtml) div id='lookupResults:CatResultList:0:aapPartType:list-by-cat:22:aapProd:aapProd:compareChkbx' class='ui-chkbox ui-widget selectBooleanCheckbox' http://localhost:8080/epcfe-web/main.xhtml
nsChildContentList
nsEventListenerManager
delete PrimeFaces.widgetCache[id];