My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 2137: Unable to clean up fullCalendar memory usage with destroy.
1 person starred this issue and may be notified of changes. Back to list
Status:  Released
Owner:  ----
Closed:  Jun 2014


Sign in to add a comment
 
Reported by thedra...@gmail.com, Apr 23, 2014
This bug can be reproduced by going to:
http://jsfiddle.net/68fYv/3/

Current Behavior:
I create a fullCalendar on a div, then call fullCalendar('destroy'); on that div.
Chrome Heap Profiler reports hundreds of lose divs are unreachable by still referenced in the background.
Memory usage grows rapidly.

Desired Behavior:
Calling fullCalendar('destroyed') or calling 'fullCalendar(options)' on the same div, will clean up resources for the previous instance.

Easy steps for verification:

Using Chrome, go to 'Window -> Task Manager' and run the above jsfiddle example.

Watch the memory usage explode.

Is there a recommended way to clean up fullCalendar instances that I'm not following?


Jun 7, 2014
Project Member #1 adamrs...@gmail.com
(No comment was entered for this change.)
Status: Reproducing
Labels: Type-Bug
Jun 10, 2014
Project Member #2 adamrs...@gmail.com
I fixed a leak due to have selectable:true (or droppable:true)...

https://github.com/arshaw/fullcalendar/commit/914b28a046ad56ec307f423de6d562305742d240
Status: Implemented
Jun 10, 2014
Project Member #3 adamrs...@gmail.com
before the bugfix...
before_month_memory.png
31.8 KB   View   Download
before_agendaWeek_memory.png
32.2 KB   View   Download
before_month_heap.png
14.0 KB   View   Download
before_agendaWeek_heap.png
14.4 KB   View   Download
Jun 10, 2014
Project Member #4 adamrs...@gmail.com
after the bugfix...
after_month_memory.png
32.8 KB   View   Download
after_agendaWeek_memory.png
32.7 KB   View   Download
after_month_heap.png
13.7 KB   View   Download
after_agendaWeek_heap.png
13.9 KB   View   Download
Jun 10, 2014
Project Member #5 adamrs...@gmail.com
This test initializes/destroys the calendar 100 times with a 200ms delay. In the repo, it it under tests/memory_leak.html

Handlers attached to the `window` and `document` were not being cleaned up, so references to the Calendar object were sticking around, as well as their references to the detached DOM nodes.

You'll notice that overall memory usage still isn't that great in Chrome. But whereas before it kept going up and up and up with no limit, now it seems to cap at ~25mb, then go back down, and repeat. I believe this is due to circular references of objects, due to the way I do "parasitic inheritance" (where objects uses closures and a cached reference to `this` in a variable called `t`). Chrome seems to only deal with the circular references when it reaches the 25mb cap. If the project began to use the standard style classical inheritance, I bet GC would be much more efficient.
Jun 10, 2014
Project Member #6 adamrs...@gmail.com
The main victory here is that the heap size stays at ~1mb where before it would go >35mb and higher
Jun 11, 2014
Project Member #7 adamrs...@gmail.com
 Issue 2167  has been merged into this issue.
Jun 15, 2014
Project Member #8 adamrs...@gmail.com
this issue has been addressed and version 2.0.1 has been released: http://arshaw.com/fullcalendar/download/
Status: Released
Sign in to add a comment

Powered by Google Project Hosting