Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

memory leak in scheduleTask #92

Closed
BryanCrotaz opened this issue Apr 9, 2018 · 2 comments
Closed

memory leak in scheduleTask #92

BryanCrotaz opened this issue Apr 9, 2018 · 2 comments

Comments

@BryanCrotaz
Copy link

BryanCrotaz commented Apr 9, 2018

weak map is not being cleaned up.

getTimersDisposable leaves an entry in the registeredTimers WeakMap and individual cancelIds are left after tasks have completed

@BryanCrotaz
Copy link
Author

BryanCrotaz commented Apr 9, 2018

Doesn't leak:

  _openHandler() {
    if (this.onOpened) {
      run(() => {
        schedule('sync', () => {
          if (!this.isDestroyed && !this.isDestroying && this.onOpened) {
            this.onOpened(this, this.url);
          }
        });
      });
    }
  }

Leaks:

   _openHandler() {
    if (this.onOpened) {
        scheduleTask(this, 'sync', () => {
          if (this.onOpened) {
            this.onOpened(this, this.url);
          }
        });
    }
  }
...
  destroy() {
    runDisposables(this);
 
    this.close();
    this.onOpened = null;
    this.onClosed = null;
    this.onError = null;
    this.onMessage = null;

    this._super();
  }

@BryanCrotaz BryanCrotaz changed the title memory leak in all run-tasks memory leak in scheduleTask Apr 9, 2018
@BryanCrotaz
Copy link
Author

I think the cancelId is being left in the registeredTimers array once the scheduled execution is complete. This is a problem for long lived objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant