Kernel memory leak detector
modulename: debug_kmemleak.ko
and/orkmemleak.ko
configname: CONFIG_DEBUG_KMEMLEAK
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
details.
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).
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
details.
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:
selects
CONFIG_DEBUG_FSCONFIG_STACKTRACE
CONFIG_KALLSYMS
CONFIG_CRC32
CONFIG_STACKDEPOT
CONFIG_STACKDEPOT_ALWAYS_INIT