kmemleak_alloc(9)
π 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'sptrπ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 thanmin_countis found, the object gets reported as a memory leak π. and the special values? iconic:- if
min_countis0, the object is never reported as a leak π - if
min_countis-1, the object is ignored β not scanned, and not reported as a leak. it just exists, unbothered, moisturized β¨
- if
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 π
- Kernel file
./mm/kmemleak.c kmemleak_alloc_percpu(9)kmemleak_vmalloc(9)kmemleak_free(9)kmemleak_free_part(9)kmemleak_free_percpu(9)kmemleak_update_trace(9)kmemleak_not_leak(9)kmemleak_transient_leak(9)kmemleak_ignore_percpu(9)kmemleak_ignore(9)kmemleak_scan_area(9)kmemleak_no_scan(9)kmemleak_alloc_phys(9)kmemleak_free_part_phys(9)kmemleak_ignore_phys(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms