Date: Wed, 14 Jun 2006 01:05:31 +0000 From: "Wojciech A. Koszek" <wkoszek@freebsd.org> To: freebsd-current@freebsd.org Subject: (no subject) Message-ID: <20060614010531.GA2033@FreeBSD.czest.pl>
next in thread | raw e-mail | index | archive | help
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@FreeBSD.org http://FreeBSD.czest.pl/dunstan/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060614010531.GA2033>