ReactiveX / ReactiveX/rxjs

animationFrames() has memory leak.

Open
#6,946 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
31.7k
Forks
3k
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

animationFrames will add subscriptions again again before unsubscribe.

Expected behavior

Here I describe the problem.
I can't find the logic of removing sub subscription inside animationFrames.
So I add this to source code in Subscription class.
image
Add this to project code.
image
You will see this.
image
Shouldn't they be removed from array:this._finalizers over time???

Reproduction code
As shown in the prev section.
Reproduction URL

No response

Version

7.5.5

Environment

No response

Additional context

No response

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 with the reported animationFrames behavior in RxJS 7.5.5 and inspect how Subscription manages its _finalizers during repeated subscriptions and unsubscribe. The issue has no runnable reproduction or named test; done should mean confirming that repeated animationFrames subscriptions no longer accumulate after unsubscribe, with a regression test covering that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.