ksize(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ksize(9) β€” like, the kernel API manual bestie πŸŽ€

okay so this is ksize, page 9 of the Kernel API Manual, and no cap it's a tiny little function with a big ol' personality. let's get into it ✨


🌸 NAME 🌸

ksize β€” Report full size of underlying allocation πŸ’–

like literally it tells you how much memory is actually chillin' behind that pointer. iconic.


πŸ¦‹ SYNOPSIS πŸ¦‹

size_t ksize (const void *objp );

that's it. that's the whole vibe check. one argument, one size_t back. slay πŸ’…


✨ ARGUMENTS ✨

  • objp β€” pointer to the object 🫢 like, the thing you wanna measure. the main character of this whole operation, fr fr.

πŸ”₯ DESCRIPTION πŸ”₯

okay so listen πŸ‘‘ β€” this one should only be used internally to query the true size of allocations. that's the whole assignment. that's what it does.

it is not meant to be a way to discover the usable size of an allocation after the fact. so don't be out here using it like a little detective πŸ•΅οΈβ€β™€οΈ β€” instead, use kmalloc_size_roundup. periodt.

🚨 and this part matters, bestie: using memory beyond the originally requested allocation size may trigger KASAN, UBSAN_BOUNDS, and/or FORTIFY_SOURCE. like do not do that. the vibes will be rancid and the tools will absolutely come for you πŸ’€

πŸŽ€ RETURN πŸŽ€

size of the actual memory used by objp in bytes πŸ’– that's the number. that's the whole tea. ⭐


🌈 SEE ALSO 🌈

the friend group 🫢 go say hi:


and that's the page!! 🌸 source is ./mm, dated October 2026, ksize(9) β€” ily, go free your memory responsibly πŸ§šβ€β™€οΈπŸ’œ

πŸ“¦ where this page comes from