Where does the data go when using file_uploader? When does it get deleted?

Oh, of course it is. It is just the items that are session-sppecific. But st.session_state itself is global.

So don’t do st.session_state = {}, use st.session_state.clear() instead. Try it in my deployment (for limited time).

I was unable to replicate the issue with your other example, it works as expected as far as I can tell.