Shiny - managing memory consumed by plotly


I’ve created a shiny app and am hosting it on the intranet at work. The app has several plots with a lot of data points, so the graphs do consume non-trivial amounts of memory. When the underlying data changes, my app gives the user the option to refreshes these plots by using the new data. The problem is that the app consumes more memory with each refresh, leading me to believe that somehow the memory is not being cleared from plotlyEnv.

A similar issue is disucssed here:

I couldn’t get the hack mentioned in the above to work. My question is this: is there a way to clear the graphs from plotlyEnv from within the code so that refreshing the plots does not keeping increasing the memory usage? Any suggestions would be appreciated


This issue was resolved a long time ago – I believe when plotly hit 4.0.0. The most recent version is 4.6.0. Try upgrading to see if it fixes the problem