ICEfaces
  1. ICEfaces
  2. ICE-3351

Memory: certain tag objects and string objects representing XHTML tags are unnecessarily repeated

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.1
    • Fix Version/s: 1.8DR#1, 1.8
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Any

      Description

      Each hard-coded XHTML tag in a JSP document is generating a new string object instead of reusing a static/constant field containing the same value. For example, if a JSP documen has 50 hard-coded <div>'s, then 50 string objects with the value "div" will be created. Since this is being done for every client, it is consuming an important amount of memory.

      It is important to note that each of these strings is referenced by 3 objects: an AttrImpl object (DOM), a UIXhtmlComponent object (component tree) and an XhtmlTag object (tag tree). It is also important to mention that XhtmlTag objects and IceOutputTextTag objects are being created on a per-client basis, when only one set of these objects is supposed to exist per document.

      Moreover, certain tag objects especially XhtmlTag and IceOutputTextTag are being kept in memory per client. For example, with one client there are 15 CommandButtonTag objects, with two clients there are 25, with 3 clients there are 35, etc. There should be only one tag tree per document in the whole application.

        Issue Links

          Activity

          Hide
          Arturo Zambrano added a comment -

          The fix consists of adding to the parse() method of Parser.java the following code:

          pageContext.removeAttribute(
          "javax.faces.webapp.GLOBAL_ID_VIEW",
          PageContext.REQUEST_SCOPE);

          ...right after:

          pageContext.removeAttribute(
          "javax.faces.webapp.COMPONENT_TAG_STACK",
          PageContext.REQUEST_SCOPE);

          This way, the additional tag objects and strings have no more incoming references, so they can be garbage collected.

          Show
          Arturo Zambrano added a comment - The fix consists of adding to the parse() method of Parser.java the following code: pageContext.removeAttribute( "javax.faces.webapp.GLOBAL_ID_VIEW", PageContext.REQUEST_SCOPE); ...right after: pageContext.removeAttribute( "javax.faces.webapp.COMPONENT_TAG_STACK", PageContext.REQUEST_SCOPE); This way, the additional tag objects and strings have no more incoming references, so they can be garbage collected.

            People

            • Assignee:
              Unassigned
              Reporter:
              Arturo Zambrano
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: