Streamlit memory issue

Furthermore, what would you suggest to do in the short term as a workaround for this problem?
Production environment is impacted and the problem is serious, need to put the app in a safer spot asap.

Possible changes that comes to my mind:

  1. Scale UP - Increase Heroku memory (Dyno size/number of Dynos) : Expensive and effectively would only post-pone the crash (we have daily restart in place though).
  2. Switch to st.cache_data - Refactor the code avoiding to handle cache directly through st.session_state (dictionary) but instead use st.cache_data annotations (and similars), maybe specifying ttl/max entries : Refactor would still take some time and there’s no guarantee that problem would be solved.
  3. Switch from Heroku to AWS - Change hosting platform : there are evidences that the same problem might happen with AWS as well ( Memory leak when hosting streamlit v1.34 app on AWS EC2 instance via Linux docker container).

Any other solution or comment on the proposed ones would be really appreciated :pray: