Hello, I have implemented The MemTrace -- a simple tool, which lets you see where kernel memory allocation was done -- source file name, line number, malloc'ed type and size, as well as the address of the allocated memory. Not only does it track memory allocation, but also free() calls with allocated addresses. Each allocation is tracked until free() is done, which means memory chunk was properly deallocated. Such case won't be reported. Results are kept in a fixed-sized cache, which is available through sysctl vm.memtrace.show. Number of allocations is specified with MEMTRACE_ENTRIES variable. If large number of unfree'ed memory is investigated, there's a possibility for fetching useful data via ktr(9) for later analysis. Thus, you'll have to set KTR_MALLOC in debug.ktr.mask. You can also use ALQ with KTR, if you want to obtain a lot of entries. Packed source code is here: http://people.freebsd.org/~wkoszek/mtrace-20060613.tgz You can get this tool from perforce.freebsd.org, exact location: //depot/user/wkoszek/mtrace/... Please let me know if you've found it useful. I wonder if we could have it commited, upon careful testing. Thanks, -- Wojciech A. Koszek wkoszek_at_FreeBSD.org http://FreeBSD.czest.pl/dunstan/Received on Tue Jun 13 2006 - 21:05:00 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:57 UTC