Opened 5 years ago

Closed 3 years ago

#15270 closed bug (fixed)

Datepicker - Memory leak

Reported by: jigar140291 Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.12.1
Keywords: Cc:
Blocked by: Blocking:


I have a single page application with component programming. It has multiple pages out of which few of them have date picker in it. I found out my application was leaking and have detached nodes due to which the whole component stays in memory even after the user moves to a different page (destroying the component), GC was unable to clear it. after investigation, I found out that showdatepicker function stores the current DOM instance of datepicker to this._curInst into global space which is not getting cleared at the time of destroying datepicker, which is causing a leak.

I have created a small demo at


  1. Open date picker by clicking on the input box once and close.
  2. click on destroy button.
  3. Open debugger and take heapsnapshot under memory and look for detached nodes. out of which look for the yellow node which shows reference to _curInst variable.

Tested on: Chrome, Mozilla Firefox, IE.

Temporary fix:

On destroying component or datepicker add this line

$.datepicker._curInst = null

If you are using Angular2 for eg.

   $.datepicker._curInst = null

Change History (1)

comment:1 Changed 3 years ago by Felix Nagel

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.