-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Constant memory leak #1151
Comments
Are you able to reproduce this with something like |
A couple other thoughts... You might want to try eliminating variables one by one. For example, possible sources of memory leakage:
It would probably be best to eliminate the http download and replace it with a CSV on disk, and then decrease the |
Thanks for the suggestions. I eliminated all 3rd party libraries and am able to reproduce the leak with just Not sure I'm going to be able get to the bottom of this, so feel free to close this issue until I have something more specific. |
This is an interesting issue. I won't close it, but if you do find out more, please keep us updated. |
Also, can you post the code for your app that uses |
I suspect this may be the source of the plotly memory leak. cc @cpsievert |
If replacing Anything in particular that you're suspicious of @jcheng5? Perhaps the |
Yeah, the fact that creating these objects have the side effect of storing (large?) amounts of data in |
No, and that is really what enables this black magic. |
Ugh... sorry Carson but I very strongly believe this is a bad idea. The memory leak aspect alone is extremely troubling, and it also means that plotly plots can't be serialized across R sessions which will break them in RStudio Server if you leave them for too long (and even RStudio Desktop in some cases where it restarts the R session but tries to preserve your environment, such as "Build and Reload" on a package). There is a way to accomplish a very similar effect to what you want here, but without the hackiness or memory leak. It is based on the concept of monads, which @hadley and I have been looking closely at for R. The basic idea is that when you have a thing like a plotly object, that isn't itself a data frame, but it "has" a data frame inside of it; and you have a function (like augment) that transforms data frames but knows nothing about plotly; then you can pipe them together using a new operator (Haskell calls it plot_ly(df) %<*>%
loess(whatever) %<*>%
augment() So if |
Btw it wouldn't be your job to make the generic operator, just the implementation of it for plotly, which would be like 3 lines of code. This assumes the existence of a @hadley/monad package. |
Thanks @jcheng5, and no need for apologies, I'll have a look at https://github.com/hadley/monads |
Oh I totally forgot that he actually started on a package :) The operator is |
Closing for now because the problem was in plotly. If you still are experiencing another memory leak in |
I created a simple dashboard, a single plot with plotly and a couple small tables. It works great, but seems to eat about 100MB of memory per hour. Running gc() does not reclaim any memory, so I have to kill R and restart the server twice a day or my 2GB server will run out of memory.
I split the dashboard in two: one with just the plot and other with just the tables. The plotly dashboard is the one consuming 90% of the memory. Any ideas how to further debug?
ui.R
server.R
The text was updated successfully, but these errors were encountered: