drmm_kzalloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– drmm_kzalloc β€” the Kernel API Manual, bestie edition ✨

okay so this is drmm_kzalloc(9) from the Kernel API Manual, and it's genuinely one of the good ones β€” it's giving "allocated memory that cleans up after itself" energy and honestly? obsessed. πŸŽ€


✨ NAME ✨

drmm_kzalloc β€” a &drm_device managed kzalloc() 🫢


🌸 SYNOPSIS 🌸

void * drmm_kzalloc (struct drm_device *dev , size_t size , gfp_t gfp );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • dev β€” the DRM device πŸ’… this is the main character whose lifetime the memory is tied to
  • size β€” size of the memory allocation, aka how much room you're asking for
  • gfp β€” GFP allocation flags, the little settings menu for how the alloc happens

🌈 DESCRIPTION 🌈

Bestie listen. This is a drm_device managed version of kzalloc. The allocated memory is automatically freed on the final drm_dev_put β€” like, you don't have to manually free it, it just knows. ✨

And if you're impatient (valid), memory can also be freed before the final drm_dev_put by calling drmm_kfree. So you've got options, iykyk πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/drm/drm_managed.h 🌟 and its little friend group:


ngl the whole drmm_* family ate and left no crumbs β€” go read the header, it's right there in ./include/drm/drm_managed.h πŸ“

and that's the whole page, bestie!! this one comes to you from ./include/drm (that's the source, mwah 🫢) and it's dated October 2026 β€” iconic era, no cap. slay, go free your memory responsibly πŸ’œβœ¨πŸ§š

πŸ“¦ where this page comes from