打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
kernel memory leak detect


 KMEMCHECK


If you need to check if a kernel module has leaked memory and your machine has x86 architecture, you can use KEDR system, it includes a memory leak detector.

KEDR does not require you to rebuild the kernel. The online docs (see "Getting Started", for example) describe how to install and use KEDR. In short, the procedure is as follows.

Installation (from source): untar source archive - cmake <...> - make - make install

Start KEDR before you load your module:

$ kedr start <name_of_the_module_to_analyze> -f leak_check.conf

Then you can load your module and work with it as usual. After you unload it, KEDR will give you a report in debugfs (usually debugfs is mounted to /sys/kernel/debug), for example:

$ cat /sys/kernel/debug/kedr_leak_check/infoTarget module: "...", Memory allocations: 3Possible leaks: 2Unallocated frees: 0

The file possible_leaks from /sys/kernel/debug/kedr_leak_check/ provides information (address, size, call stack) about each leaked memory block.

Finally, you can stop KEDR (note that /sys/kernel/debug/kedr_leak_check/ will disappear):

kedr stop

If you are using a system with architecture other than x86, Kmemleak may also be helpful although it is a bit more difficult to use. You will probably need to rebuild the kernel with CONFIG_DEBUG_KMEMLEAK parameter set to 'y'. Still, Kmemleak is a very useful tool too. See Documentation/kmemleak.txt in the kernel sources for details.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
kmemleak
Android native heap memory leak 实战(二)
Linux memory leak detection ? The Web Site Pe...
Memory Leak Using JSON
Memory leak finder
Finding Memory Leaks Using the CRT Library
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服