danvk / danvk/dygraphs

Annotations leak memory

Open
#656 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
3.2k
Forks
589
PR merge metrics
No merged PRs in 30d

Description

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:

  1. removeEventListener for div elements is never called
  2. "addAndTrackEvent" pushes events to "registeredEvents_" array, but they are never removed from there.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the annotations plugin and tracing setAnnotations, addAndTrackEvent, registeredEvents_, and the event-handler cleanup path. Reproduce repeated annotation additions and removals, then verify that div listeners are removed and registeredEvents_ does not retain obsolete events or grow indefinitely.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.