0 Replies Latest reply on Nov 5, 2007 7:14 AM by Stefan Nawrath

    rich:tree memory leak

    Stefan Nawrath Newbie


      I'm using a rich:tree as navigation bar in my application. At my frontend I have 2 Frames (menuFrame , mainFrame). Every tree node has a link like t:commandLink who loads a new site in the main frame. I user myFaces 1.1.5 and richfaces 3.1.2 Tomcat and Java 5.

      The memory of FF or IE increases permanently when I select or toggle the nodes of the tree.

      At the loaded scripts in FireFox JavaScript Debugger there are scripts for loaded nodes (called like jsf page, here MenuTree.jsf). After some clicks in my app I have seen, that every click loads a new MenuTree.jsf. 10 clicks creates 10 MenuTree.jsf files and so on. The scripts are not unloaded because of two onclick functions defined on the tree-item object.

      tree-item.js line 22+
      this.elementID.mainRow = this.id + Tree.ID_DEVIDER * Tree.ID_MAIN_ROW;
      this.elementID.handle = this.id + Tree.ID_DEVIDER + Tree.ID_HANDLE;

      Here is some code of my MenuTree.jsp

       <f:loadBundle basename="resources.MCResource" var="properties" />
       <a4j:region id="menuRegion">
       <h:form id="menu">
       <rich:tree id="menuTree" value="#{MenuTreeJsfBean.menuTree}"
       rowKeyVar="rowKey" switchType="ajax"
       binding="#{MenuTreeJsfBean.htmlTree}" var="node"
       <f:facet name="iconCollapsed">
       <h:graphicImage url="/menu-images/treeCollapsed.gif"
       styleClass="icon" />
       <f:facet name="iconExpanded">
       <h:graphicImage url="/menu-images/treeExpanded.gif"
       styleClass="icon" />
       <rich:treeNode id="Root" type="Root">
       <h:outputText value="#{node.description}" />
       <rich:treeNode id="CommandLink" type="CommandLink"
       ignoreDupResponses="true" icon="#{node.iconSmall}"
       <t:commandLink id="commandLink" immediate="true"
       value="#{node.displayName}" target="#{node.target}"
       actionListener="#{MenuTreeJsfBean.selectNode}" styleClass="node"
       <f:attribute name="selectedNode" value="#{node}" />
       <rich:treeNode id="Hyperlink" type="Hyperlink"
       icon="#{node.iconSmall}" iconLeaf="#{node.iconSmall}">
       <h:outputLink id="outLink" target="#{node.target}"
       value="#{node.linkHRef}" styleClass="node">
       <h:outputText value="#{node.displayName}" />

      I've got the same problems if I use a a4j:poll entry to refresh my tree every 30 sec. Than there are many more scripts loaded and never unloaded.

      I think this can be a Bug in the richfaces scripts. The scripts are not unloaded while the functions are not set to null and so there are many script snipes loaded and the memory of the browser increases.

      Is there anybody confirm with this problem. Or can I do something to prevent this.