4min chapter

 Rustacean Station  cover image

Rust for Rustaceans by Jon Gjengset

Rustacean Station

CHAPTER

Is It OK to Deallocate Memory in Rust?

In general all of the memory backed operations in Rust are infallible like they if you do something like Vekt.push it doesn't return a result but there's no way for you to know that you ran off memory because what happens under the hood is that push if it needs to try to allocation more memory and if it fails to allocate more memory at panics which as you say unwinds. The ask was we need fallible versions of all potentially allocating operations this islike Vekt Reserve Vekt Push string append in hash map insert and so any operation that could potentially allocate needs to have a sort of tri version of the method that returns an error if memory

00:00

Get the Snipd
podcast app

Unlock the knowledge in podcasts with the podcast player of the future.
App store bannerPlay store banner

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode

Save any
moment

Hear something you like? Tap your headphones to save it with AI-generated key takeaways

Share
& Export

Send highlights to Twitter, WhatsApp or export them to Notion, Readwise & more

AI-powered
podcast player

Listen to all your favourite podcasts with AI-powered features

Discover
highlights

Listen to the best highlights from the podcasts you love and dive into the full episode