what is the difference between kmemleak and kmemcheck? and How to enable these tools on Android operating systems?

2.2k views Asked by At

Is there any special usage/advantage over each other (kmemleak and kmemcheck) ? Can I enable these tools on Android operating system (not Linux OS) please guide me how.

Ref: https://www.kernel.org/doc/Documentation/kmemcheck.txt https://www.kernel.org/doc/Documentation/kmemleak.txt

1

There are 1 answers

1
Eugene On

Kmemleak and Kmemcheck perform different tasks, none is better than the other.

1. Kmemleak checks if some memory blocks were allocated by the kernel but were not freed (that is, checks for memory leaks in the kernel, hence the name). The performance overhead is usually acceptable.

2. Kmemcheck checks if some kernel code accesses uninitialized memory. Example: the kernel code allocates a structure, does not fill it with values and then reads something from that structure. Kmemcheck should detect that.

Kmemcheck does not check for memory leaks, by the way.

Kmemcheck often slows down the system so much that graphical environments are impossible to use. The boot process may also become very slow (and may fail).

3. If I am not mistaken, Kmemleak works at least for x86 and ARM. Kmemcheck is x86 only.

4. Unfortunately, I cannot say how to enable Kmemleak on Android, I only used it on desktop Linux systems.

5. Depending on what you are trying to accomplish, there could be tools that suit your needs better. For example, the Linux kernel has a variety of debugging features that can be enabled and built in. Again, I have no experience with Android kernel in this regard.