This app has gone over its resource limits

I hosted my first app on streamlit share a few days ago and when I open it today I find this error.


This app has gone over its resource limits. Common causes for this are memory leaks in the app logic, using caching without a TTL, or leaving large datasets in memory even after they are no longer needed. Please update and reboot this app to try again.

Is there any way to solve this error other than rebooting it from time to time.

Hi @Pratheeksha !

What kind of app/processing are you building? If possible, can we have a link to you Streamlit Share app / code source, that would help us go to the root cause of the problem?


This the streamlit app!

So I went to check the source code, and you are indeed putting a lot of things into cache :slight_smile:

Can you try using a max_entries or TTL to limit the number of elements saved in the long term for functions where you think caching may be less necessary? We’re looking into writing up some more recommendations for this:

For example:

@st.cache(allow_output_mutation=True, max_entries=10, ttl=3600)
def recommendations(title):

Hope it helps,

Hi! Thanks a lot for extending the invitation yesterday. I have made an image captioning app. I am downloading some weights (only during the boot up) and caching them. (Although, i am doing conditional check, I have still cached the function). This could be the reason.

Even my app has gone over the resource limits.
Source code

I remove st.cache() from download_data() function and trying again. For now, it’s working. I am also using global variables for my models (Encoder and decoder) which would i would like to avoid since they don’t allow me to cache the load_model() function.

But I think my app does not have expensive computations…
My app went over resource limits again after removing st.cache(). I think I am performing four beam searches with beam indices - 3,4,5,6 which is computationally intensive one after another. But it worked fine for a day.

I don’t know about memory leaks other than dangling pointers in C! :sweat_smile: :sweat_smile:

Thanks for the solution @andfanilo. I will try this out and come back to you if any issue arises.