You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2013/01/15 15:50:14 UTC

[jira] [Commented] (WICKET-4975) client side memory leak on date picker

    [ https://issues.apache.org/jira/browse/WICKET-4975?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13553855#comment-13553855 ] 

Martin Grigorov commented on WICKET-4975:
-----------------------------------------

Isn't is better to use a global listener that triggers on '/ajax/call/complete' and checks for existence for the date picker DOM element and if not - removes all JS objects related to it ?
Something like https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/ajax/res/js/wicket-ajax-jquery.js#L2495

I find it much simpler.
                
> client side memory leak on  date picker
> ---------------------------------------
>
>                 Key: WICKET-4975
>                 URL: https://issues.apache.org/jira/browse/WICKET-4975
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-datetime
>    Affects Versions: 1.4.21, 1.5.8, 6.4.0
>         Environment: any
>            Reporter: Ernesto Reinaldo Barreiro
>            Priority: Minor
>         Attachments: datepicker-1.5.tar.gz, datepicker.tar.gz, WICKET-4975.patch
>
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira