Print memory consumption

Hello. Is there a way to print memory consumption (within the streamlit interface itself) as an app runs? Thanks!

Hey @jgcaceresr,

That’s a capability of python itself with the sys package, so yes you can.

import sys
import streamlit as st

my_list = [x for x in range(0, 10000)]
st.write(sys.getsizeof(my_list))
st.write(list)

gives:
Screen Shot 2021-11-04 at 2.55.53 PM

Checkout other tips and tricks for python here

Happy Streamlit-ing!
Marisa

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.