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 when using newPlot or update #28

Closed
Alterock13 opened this issue Dec 13, 2018 · 6 comments
Closed

Memory leak when using newPlot or update #28

Alterock13 opened this issue Dec 13, 2018 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@Alterock13
Copy link

Alterock13 commented Dec 13, 2018

Hi,

I'm running Plotly as a way to display data coming from a database, with around 800 new points/second.
As I let my application running, I notice that my RAM usage is steadily inscreasing, eating up to 10Gb of RAM over the course of half an hour.

Looking at Plotly issues on GitHub, I've noticed that Plotly users have reported that it was happening to them 1755 but I think that a recent patch was supposed to fix that.

I've tried both newPlot and update as a way to refresh my plot. Here's my current code :

       this.interval = interval(1000);
       this.subscribe = this.interval.subscribe(val => {
                this.traces = [this.data[0]];
                this.lastUpdateChange.emit(new Date());
                if(this.highThresholdEnabled || this.lowThresholdEnabled){
                    this.onThresholdChange();
                } else{
                    Plotly.update(
                        this.layout['title'], 
                        this.traces, this.layout, 
                        this.options)
                }});

I'm running out of ideas for this problem, does anyone know how I could stop this memory leak?

Thanks in advance.

@andrefarzat
Copy link
Collaborator

This one is even hard to simulate. When you say memory leak, you mean the browser freezes ?
What Plotlyjs version you're using ?

@Alterock13
Copy link
Author

Well, more that the RAM usage of my Chrome/Firefox/Edge (tested with all three of them) increases over time. It starts at around 400 Mo and then, as time goes on, go to 1Go, then 2... Up until the browser tab crashes.

And this behavior stops if I do not update the graph. So that's why I suppose that the update mechanism may cause that.
A Plotly.newPlot(...) has the same consequences.

@andrefarzat
Copy link
Collaborator

@Alterock13 just updated the lib to use Plotly.react instead of Plotly.newPlot in the update method of the angular component. Please, update to version 0.2.2 and check if this still persists. In parallel, I will create an example on our demo to replicate this behaviour

@andrefarzat andrefarzat self-assigned this Jan 8, 2019
@andrefarzat andrefarzat added the bug Something isn't working label Jan 8, 2019
@Alterock13
Copy link
Author

Thanks !
I'll give it a go tomorrow and keep you posted on the results.

@Alterock13
Copy link
Author

Hi

So I've tried updating and running the app again. And I still have a rising memory consumption.
I'll keep testing with different parameters and keep you posted if there are any changes.

@andrefarzat
Copy link
Collaborator

@Alterock13 I could not replicate this issue. I might not have tried correctly, so I added a "memory-leak" page on the demo with your example to try to simulate it. I left it running on my mac using opera and the memory didn't grew much in about 5 minutes which I watched.
I am closing this issue for now, but please, check the code I just pushed on master ( 238fcc9 ) and update it if necessary and create a PR, so I can see the issue and debug it better 😸

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants