Controlling memory release on app with large pages and many sessions

Hi everyone, hope you’re all doing great.

I’m running an app which multiple different webpages with a lot of image content, using st.experimental_get_query_params() to determine what’s displayed on the page. Usually a user will enter a URL, such as http://server:port/?param1=value1a&param2=value2a, view the page, and then move on to the next page by entering http://server:port/?param1=value1b&param2=value2b as the URL. All images are generated on the fly and take some time to create, so it’s quite common to open multiple tabs to let them all load at once.

Now the issue is that closing a tab doesn’t release the memory automatically (There’s a related GitHub issue that I crossposted on). Over time as the number of viewed pages increases, the memory usage grows out of control and the app crashes. Is there a way I can manage the memory usage? I’m already using TTL on my st.cache functions