1. Kernel Add memory leak feature option kernel memory leak detector kernel debugging memory leak debugging Compile kernel With debug info go through make menuconfig into the configuration options interface to enter kernel hacking--and trace to see
2. When booting, mount the Debugfs file system in Android init.xxx.rc file: Mount Debugfs debugfs/sys/kernel/debug Pure Linux system/etc/fstab:deb Ug/sys/kernel/debug Debugfs Defaults 0 0
3. After running the application, review the memory tracker Memleak Cat/sys/kernel/debug/memleak perform multiple times to ensure the correct results are obtained
kmemleak.cThe print_unreferenced function in the file will print out the leaked address
seq_printf (seq, "Unreferenced Object0X%08LX (size%zu): \ n ", Object->pointer, object->size); For example, the address is 0x11223344
4. Use Addr2line to decompile the resulting address to get the file's function xxxxx-linux-addr2line-e vmlinux 11223344//can get the file and the number of rows that the problem appears
The Linux kernel memory leak tool uses