Skip to content

fix: Deephaven express memory leak#277

Merged
mofojed merged 1 commit intodeephaven:mainfrom
mattrunyon:plotly-express-memory-leak
Feb 20, 2024
Merged

fix: Deephaven express memory leak#277
mofojed merged 1 commit intodeephaven:mainfrom
mattrunyon:plotly-express-memory-leak

Conversation

@mattrunyon
Copy link
Copy Markdown
Collaborator

@mattrunyon mattrunyon commented Feb 12, 2024

Fixes #179

Tested by running a server with and without this fix and opening the Memory dev tools tab. Then ran the code in the ticket. The tab without this fix grew steadily in memory consumption over several minutes. The tab with the fix stayed fairly consistent over the same period of time.

@mattrunyon mattrunyon added the plotly-express Involves plotly-express plugin label Feb 12, 2024
@mattrunyon mattrunyon self-assigned this Feb 12, 2024
const columnData = chartData.getColumn(
column.name,
val => this.chartUtils.unwrapValue(val),
this.chartUtils.unwrapValue,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could also set this method in PlotlyExpressChartModel in the construct when we're initializing this.chartUtils, e.g.

this.chartUtils = new ChartUtils(dh);
this.unwrapValue = this.chartUtils.unwrapValue.bind(this.chartUtils);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Does this work in DHC? I'm getting an error in DHE with the test snippet from #179 -

User callback ( (e2) => this.handleFigureUpdated(e2, id) ) of type  updated  failed:  JavaScriptException {stackTrace: null, backingJsObject: TypeError: Cannot destructure property 'dh' of 'this' as it is undefined. at unwrapValue

With unwrapValue bound to this.chartUtils the charts work fine, haven't checked for memory leaks though.

@mattrunyon mattrunyon force-pushed the plotly-express-memory-leak branch from f7ece43 to 53e2bfb Compare February 15, 2024 21:03
@mattrunyon mattrunyon marked this pull request as ready for review February 15, 2024 21:03
@mattrunyon mattrunyon requested a review from mofojed February 15, 2024 21:03
@mattrunyon mattrunyon force-pushed the plotly-express-memory-leak branch from 53e2bfb to 1e1d26a Compare February 16, 2024 19:22
@mattrunyon mattrunyon force-pushed the plotly-express-memory-leak branch from 1e1d26a to 631ccad Compare February 16, 2024 19:24
@mofojed mofojed merged commit ff6ad50 into deephaven:main Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plotly-express Involves plotly-express plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possible memory leak in ticking plotly express charts

3 participants