Skip to main content

Search and Top Navigation

#15270 closed bug (fixed)

Opened January 31, 2018 07:57PM UTC

Closed March 23, 2020 08:53PM UTC

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
Attachments (0)
Change History (1)

Changed March 23, 2020 08:53PM UTC by fnagel comment:1

resolution: → fixed
status: newclosed