Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-4975

client side memory leak on date picker

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.4.21, 1.5.8, 6.4.0
    • 6.5.0
    • wicket-datetime
    • None
    • any

    Description

      Under certain conditions date picker component leaks memory at client side. More concretely DatePicker#renderHead tries to clean up existing date pickers via

      AjaxRequestTarget target = component.getRequestCycle().find(AjaxRequestTarget.class);
      if (target != null)
      {
      String escapedComponentMarkupId = getEscapedComponentMarkupId();
      String javascript = "var e = Wicket.$('" + escapedComponentMarkupId + "Dp" +
      "'); if (e != null && typeof(e.parentNode) != 'undefined' && " +
      "typeof(e.parentNode.parentNode != 'undefined'))

      {" + "e.parentNode.parentNode.removeChild(e.parentNode);" + "YAHOO.wicket." + escapedComponentMarkupId + "DpJs.destroy(); delete YAHOO.wicket." + escapedComponentMarkupId + "DpJs;}

      ";

      target.prependJavaScript(javascript);
      }

      but this fails if "panel" containing date pickers is completely replaced via AJAX. E.g. for date pickers placed on an AJAX navigated repeater. The result is that client side object

      YAHOO.wicket

      object grows and grows... and for

      1- Wicket 1.5.x and wicket 1.4.x this means time for creating new date pickers grows steadily.
      2- For wicket 1.6.x there seems not to have any performance hindrance (only the memory leak).

      I attach quick starts demonstrating this.

      Attachments

        1. datepicker.tar.gz
          22 kB
          Ernesto Reinaldo Barreiro
        2. datepicker-1.5.tar.gz
          101 kB
          Ernesto Reinaldo Barreiro
        3. WICKET-4975.patch
          9 kB
          Ernesto Reinaldo Barreiro
        4. WICKET-4975.patch
          3 kB
          Ernesto Reinaldo Barreiro

        Activity

          People

            mgrigorov Martin Tzvetanov Grigorov
            reiern70 Ernesto Reinaldo Barreiro
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified