From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d4db,bd5f11e645baab1c,start X-Google-Attributes: gid10d4db,public From: taj@intergate.bc.ca (Taj Khattra) Subject: mpr-1.4 - a poor man's memory profiler Date: 1996/11/13 Message-ID: X-Deja-AN: 196136534 x-original-date: Sun, 10 Nov 1996 23:58:48 -0800 (PST) followup-to: comp.os.linux.development.apps organization: ? x-auth: PGPMoose V1.1 PGP comp.os.linux.announce reply-to: taj@intergate.bc.ca newsgroups: comp.os.linux.announce -----BEGIN PGP SIGNED MESSAGE----- I have uploaded mpr-1.4 to sunsite.unc.edu:/pub/Linux/Incoming/mpr-1.4.tar.gz. It should move to directory /pub/Linux/devel/lang/c soon. Here are some excerpts from README: This is version 1.4 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.4. 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.4 - mpr: added option -F, which is similar to -f, except that it allows you to specify for which subset of source files you wish to see file name/line number information. This is useful for executables for which 'mpr -f -l' takes forever. This option was motivated by Daniel J. Mitchell . - mprfl: added support for mpr's new -F option - mpr: added option -I to specify list separator for option -i. This is required for C++ executables for which the default separator ',' may not always work, as it might be part of a function's signature. 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 Here is the LSM entry: Begin3 Title: mpr - a poor man's memory profiler for Unix programs Version: 1.4 Entered-date: 10NOV96 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@intergate.bc.ca (Taj Khattra) Maintained-by: Primary-site: sunsite.unc.edu /pub/Linux/devel/lang/c 86144 mpr-1.4.tar.gz 699 mpr-1.4.lsm Alternate-site: Original-site: Platforms: x86-linux, x86-sco, vax-ultrix Copying-policy: almost public domain End -----BEGIN PGP SIGNATURE----- Version: 2.6.3i Charset: noconv iQCVAwUBMolNOoQRll5MupLRAQGBPAQAnt1E0w2qPHuJ2rM+oiI+6Q6sAqbln9hL N3PKbmW7obEef4CvL8csfkG4XHMQS6y0FFphixq3l7Fe4iIWsGCYwnD/Itfex/Qv riSNrnucRofIzbTNALPYUOSTMhTNBG2nfMr6sCtUcRI6QKYprjlg2z4tBG6ipAz0 I3rIOdbMOk4= =mf69 -----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