From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4db,39dbb00412d18927,start X-Google-Attributes: gid10d4db,public From: taj@wimsey.com (Taj Khattra) Subject: mpr-1.3 - a poor man's memory profiler Date: 1996/10/17 Message-ID: X-Deja-AN: 190073075 organization: ? x-auth: PGPMoose V1.1 PGP comp.os.linux.announce followup-to: comp.os.linux.misc newsgroups: comp.os.linux.announce -----BEGIN PGP SIGNED MESSAGE----- I have uploaded mpr-1.3 to sunsite.unc.edu:/pub/Linux/Incoming/mpr-1.3.tar.gz. It should move to directory /pub/Linux/devel/lang/c soon. Here are some excerpts from README: This is version 1.3 of mpr, a poor man's memory profiling package for Unix programs. It supports both C and C++ programs. mpr can be used to find malloc/realloc memory leaks and memory allocation statistics and patterns - it does not find memory corruption errors. It uses a simple, brute force strategy - log all memory alloc/free requests to a file and then post-process this log file once the program has terminated. mpr keeps track of the entire call chain leading up to a memory alloc/free request, making it much easier to find memory allocation problems. This is superior to conventional methods of keeping track of only the immediate caller of a memory alloc/free routine, e.g. using __FILE__ and __LINE__. To give you an idea of what mpr can do, here are some sample outputs for the example program that is included with mpr-1.3. memory allocations grouped by call chains: (column2=number of allocs, column3=amount allocated) main(tst.c,58) 45 1440 foo(bar.c,14):bar(bar.c,28):main(tst.c,65) 200 2000 main(tst.c,53) 200 3200 foo(bar.c,19):bar(bar.c,28):main(tst.c,65) 200 4000 foo(tst.c,36):main(tst.c,64) 200 12800 foo(baz.c,21):baz(baz.c,29):main(tst.c,66) 200 51200 memory leaks grouped by call chains: (column2=number of allocs leaked, column3=amount leaked) main(tst.c,58) 21 672 main(tst.c,53) 45 720 foo(bar.c,14):bar(bar.c,28):main(tst.c,65) 92 920 foo(bar.c,19):bar(bar.c,28):main(tst.c,65) 101 2020 foo(tst.c,36):main(tst.c,64) 94 6016 foo(baz.c,21):baz(baz.c,29):main(tst.c,66) 108 27648 memory allocations grouped by size: (column1=size, column2=number of allocs) 10 200 16 200 20 200 32 45 64 200 256 200 memory leaks grouped by size: (column1=size, column2=number of allocs leaked) 10 92 16 45 20 101 32 21 64 94 256 108 Here is a summary of changes from previous versions: 1.3 - mprcc, config/mprnm.*: added support for demangling C++ names - demangle/*: added demangler for C++ names - mpr: added option -p (omit parameters) to prevent unwieldy output for C++ - malloc/gmalloc.c:initialize(): enabled mpr() and mcheck() to be called automatically on the first call to malloc(), unless the preprocessor flags -UAUTOMPR and/or -UAUTOMCHECK are used to compile library libmpr.a. This obviates the need to edit application code to add calls to mpr()/mcheck(), and thus allows users to use mpr by simply linking their applications against libmpr.a. More importantly, it allows mpr to track calls to malloc() before main() (e.g. C++ constructors). This feature was suggested by Emmanuel Chantreau . - malloc/gmalloc.c:malloc(): reversed order of calls to initialize() and __malloc_hook() in order to support AUTOMPR and AUTOMCHECK - mpr.c:mpr(): protect against multiple invocations 1.2 - config/{mprpc, mprnm}.linux: added support for linux elf. Courtesy of Werner Almesberger . - config/mprpc.sco: added support for sco5 elf - config/btx86.c:btinit(): don't get too chummy with the compiler Here is the LSM entry: Begin3 Title: mpr - a poor man's memory profiler for Unix programs Version: 1.3 Entered-date: 11OCT96 Description: mpr can be used to find malloc/realloc memory leaks and memory allocation statistics and patterns - it does not find memory corruption errors. Keywords: memory leak, memory profile, malloc Author: taj@wimsey.com (Taj Khattra) Maintained-by: Primary-site: sunsite.unc.edu /pub/Linux/devel/lang/c 85317 mpr-1.3.tar.gz 694 mpr-1.3.lsm Alternate-site: Original-site: Platforms: x86-linux, x86-sco, vax-ultrix Copying-policy: almost public domain End -----BEGIN PGP SIGNATURE----- Version: 2.6.2i iQCVAwUBMmXYOoQRll5MupLRAQG7FAQAiJCmlXI1qSI57xdD3+ehSyt95PBgDJux QdemHS6uX6JVGj0QMvGZSwoKk4eWVpNa3CgINRMzJ05YmJtLjLeL/RwUKAFjA1Gr qKQnwGxB7VmV23daod5sYG6sWvKkvX6epJtEkzgD0IISPx/l5IKVZRuwfWzwYOtO WR5pDZ+T3R0= =sdam -----END PGP SIGNATURE----- -- This article has been digitally signed by the moderator, using PGP. http://www.iki.fi/liw/lars-public-key.asc has PGP key for validating signature. Send submissions for comp.os.linux.announce to: linux-announce@news.ornl.gov PLEASE remember a short description of the software and the LOCATION. This group is archived at http://www.iki.fi/liw/linux/cola.html