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

Finalize visualizations to avoid memory leaks #1817

Open
domoritz opened this issue Nov 28, 2019 · 3 comments
Open

Finalize visualizations to avoid memory leaks #1817

domoritz opened this issue Nov 28, 2019 · 3 comments

Comments

@domoritz
Copy link
Member

Vega-Embed and Vega may be holding on to memory after a visualization is no longer needed. To fix this, you can call finalize on a Vega-Embed result (since 6.2) or Vega view.

When you know that a vis is no longer needed (i.e. the react component is unmounted), we should call finalize.

@jakevdp
Copy link
Collaborator

jakevdp commented Nov 28, 2019

Sounds good – current release targets vega-embed 5, so we'll fix this in altair 4.0.

@jakevdp
Copy link
Collaborator

jakevdp commented Dec 5, 2019

How would one know that "the visualization is no longer needed"?

@domoritz
Copy link
Member Author

domoritz commented Dec 5, 2019

Good question. Jupyterlab finalizes a view (I am changing this to be the embed result) when a cell is overwritten (https://github.com/jupyterlab/jupyterlab/blob/master/packages/vega5-extension/src/index.ts#L87) or when the cell is disposed of (https://github.com/jupyterlab/jupyterlab/blob/master/packages/vega5-extension/src/index.ts#L124).

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

No branches or pull requests

2 participants