kmemleak_alloc(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– kmemleak_alloc(9) πŸ’–

okay so bestie, welcome to kmemleak_alloc β€” that's section 9 of the Kernel API Manual, iykyk β€” and honestly this one is such a little main character. it's the function that goes "hey, i just made a new thing, remember it for me?" 🫢


✨ NAME ✨

kmemleak_alloc β€” register a newly allocated object πŸŽ€


✨ SYNOPSIS ✨

void __ref kmemleak_alloc (const void *ptr , size_t size , int min_count
, gfp_t gfp );

🌸 ARGUMENTS 🌸

  • ptr β€” pointer to the beginning of the object. like, where does this lil guy start? that's ptr πŸ’…
  • size β€” size of the object. how big is the vibe? this big πŸ“
  • min_count β€” the minimum number of references to this object. lowkey the most important one, so listen up πŸ‘‘: if during memory scanning a number of references less than min_count is found, the object gets reported as a memory leak 😭. and the special values? iconic:
    • if min_count is 0, the object is never reported as a leak πŸ™ˆ
    • if min_count is -1, the object is ignored β€” not scanned, and not reported as a leak. it just exists, unbothered, moisturized ✨
  • gfp β€” kmalloc flags used for kmemleak's internal memory allocations. yeah, kmemleak needs its own lil memory to keep track of your memory. recursion ate πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

so this function is called from the kernel allocators when a brand new object (memory block) is allocated β€” think kmem_cache_alloc, kmalloc etc. 🧚 it's basically the allocator going "new bestie alert, please add them to the group chat" so kmemleak knows the object exists and can check up on it later πŸ’œ


🌈 SEE ALSO 🌈


okay that's the whole page, ily, go forth and leak responsibly πŸ“ this one's from ./mm and it's dated October 2026 β€” so technically a little time traveler moment for us both, slay β­πŸ’…

πŸ“¦ where this page comes from