Kernel memory leak detector

modulename: kmemleak.ko




Linux Kernel Configuration
└─>Kernel hacking
└─>Memory Debugging
└─>Kernel memory leak detector
In linux kernel since version 2.6.31 (release Date: 2009-09-09)  
Say Y here if you want to enable the memory leak
detector. The memory allocation/freeing is traced in a way
similar to the Boehm's conservative garbage collector, the
difference being that the orphan objects are not freed but
only shown in /sys/kernel/debug/kmemleak. Enabling this
feature will introduce an overhead to memory
allocations. See Documentation/dev-tools/kmemleak.rst for more

Enabling DEBUG_SLAB or SLUB_DEBUG may increase the chances
of finding leaks due to the slab objects poisoning.

In order to access the kmemleak file, debugfs needs to be
mounted (usually at /sys/kernel/debug).

source code: