Skip to content

Memory Leak with Queue Scheduler and Subject #2244

@MikeRyanDev

Description

@MikeRyanDev

RxJS version: 5.0.2

Code to reproduce:
Observing a subject using the queue scheduler creates many QueueActions that are never freed.

Plnkr demonstrating issue: https://plnkr.co/edit/BBkHlpIf6MiP2eOPdIlz

Minimal code to reproduce:

import 'rxjs/add/operator/observeOn';
import { interval } from 'rxjs/observable/interval';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { queue } from 'rxjs/scheduler/queue';

const source$ = new BehaviorSubject(0);

source$.observeOn(queue).subscribe();

interval(50).subscribe(source$);

Create two heap allocation snapshots about 20 seconds apart and use the comparison tools to see the allocation delta. Example:

Heap Allocation Snapshot Example

Expected behavior:
No memory leak of previous values.

Actual behavior:
Previous values are retained in QueueActions

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions