dygraphs
dygraphs copied to clipboard
Annotations leak memory
We are adding and removing dozens of annotations per minute. Both are done by modifying an array and then calling setAnnotations. Now we have had problems with heavy memory usage and the annotations seems to be the cause for that.
For me it seems, that annotations plugin leaks memory via event handlers with in two ways:
- removeEventListener for div elements is never called
- "addAndTrackEvent" pushes events to "registeredEvents_" array, but they are never removed from there.
The event handlers registered via addAndTrackEvent
get removed when you call g.destroy()
. This make sense for listeners which live as long as the dygraph. But for annotations, which can have shorter lifetimes, you're right that this will leak. I'd be very happy to accept a PR to fix this.
Is this a leak? (detached nodes):