Skip to content

Update vega packages, and do proper view finalization#1233

Merged
tconkling merged 3 commits intostreamlit:developfrom
tconkling:tim/VegaLiteFinalize
Mar 23, 2020
Merged

Update vega packages, and do proper view finalization#1233
tconkling merged 3 commits intostreamlit:developfrom
tconkling:tim/VegaLiteFinalize

Conversation

@tconkling
Copy link
Copy Markdown
Contributor

This should fix #755, but I'd love to get @domoritz's opinion if he's available.

I'm looking at this issue now because there have been some reports of long-running Streamlit apps blowing up browser memory:

In @domoritz's original bug, he suggested that we were using view.finalize() incorrectly, though in the version of vega-embed we were previously on, there was no separate finalize returned from embed. Regardless, I've updated vega, vega-lite, and vega-embed to their latest, and we're now using that finalizer.

This PR also performs finalization at componentWillUnmount time, which is consistent with what react-vega does: https://github.com/vega/react-vega/blob/778596cb9209d9ee48c43ceac699fcd4ca5ac30a/packages/react-vega/src/VegaEmbed.tsx#L89

@tconkling tconkling requested a review from a team as a code owner March 18, 2020 22:23
@domoritz
Copy link
Copy Markdown
Contributor

Looks good to me.

@tconkling
Copy link
Copy Markdown
Contributor Author

Looks good to me.

Thanks Dominik!

* develop:
  Bump acorn from 5.7.3 to 5.7.4 in /frontend (streamlit#1220)
*/
private finalizeView = (): any => {
if (this.vegaFinalizer) {
this.vegaFinalizer()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also call this.vegaView.finalize() here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the finalizer function calls vegaView.finalize

@tconkling tconkling merged commit 02adf65 into streamlit:develop Mar 23, 2020
@tconkling tconkling deleted the tim/VegaLiteFinalize branch March 23, 2020 17:37
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

Successfully merging this pull request may close these issues.

Use result.finalize to fix memory leak

4 participants