How does canister stable memory really work?

Does the canister stable memory only work during canister upgrade to store the actor variables data and then restore the data after upgrades to the heap memory?
Is there a way I can store certain data in the stable memory and then use it in the heap only when I need it?
Thank you.

if you’re using rust, then you can do that using ic-stable-memory

1 Like