Re: tracing kmalloc calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



M Sudhir wrote:

> hi,
> 
> can anbody suggest anyway by which we can log the information each time 
> a kmalloc is called and corresponding kfree is called to free the memory 
> so as to detect any leaks by user inserted modules?
> 
> regards
> 
> sudhir
> 
>

Write your own function mykmalloc(size, flag) that adds the requested 
size of bytes to a global memory totalizer.  Likewise make a mykfree 
function that does the opposite.  When your program exits, check to see 
that your global totalizer is zero...if not you have leaks:)

HTH
-- 
Best regards,
David Stroupe
Keyed-up Software

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux