idr_destroy(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… idr_destroy β€” release all internal memory from an IDR

okay so bestie, this is idr_destroy(9) from the Kernel API Manual, and it's genuinely one of the cleanest little functions you'll ever meet β€” it's giving closure, literally πŸŽ€


✨ SYNOPSIS ✨

void idr_destroy (struct idr *idr );

🌸 ARGUMENTS 🌸

  • idr β€” the idr handle. that's it. that's the whole argument list. iconic behavior honestly πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

so after this function gets called, the IDR is empty, and you can reuse it, or you can free the whole data structure that's holding it. either way is valid, no cap ✨

the typical clean-up sequence for objects stored in an idr tree goes like this, bestie, follow along:

  1. use idr_for_each to free all the objects β€” but only if necessary, okay? don't be out here freeing stuff you don't need to free 😭
  2. then call idr_destroy to free the memory that was used to keep track of those objects 🧚

like, first you clear out the actual stuff, then you toss the little organizational system that was holding it all together. main character clean-up arc, fr fr 🫢

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./lib/radix-tree.c β€” and the whole radix-tree friend group shows up too, plus one idr bestie:


and that's the whole page, bestie πŸ’– this little gem lives in ./lib and the version vibes are dated October 2026 β€” so yeah, future-proof and fabulous. slay, go free your IDR 🌈✨

πŸ“¦ where this page comes from