This is version 1.8 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.8.

    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

See LICENSE for terms and conditions under which you may use mpr.

The following tools are supplied with mpr-1.8:
        mpr     - show log file after mapping program counters to function
                  names (and, optionally, file/line locations)
        mprcc   - show memory allocation requests/leaks grouped by call chain
        mprsz   - show memory allocation requests/leaks grouped by size
        mprlk   - show memory leaks
        mprhi   - show memory allocation histogram

One useful addition might be an extension of the tool "mprcc" that used
the entire call chain to show functions indirectly responsible for memory
allocations/leaks (cf. mprof and gprof dynamic call graphs).

The currently supported targets are:
        x86-linux
        x86-sco		(sco3 and sco5)
	x86-scogds	(sco5 with the gnu development system)
        vax-ultrix

Ports to other targets are welcome and shouldn't be difficult (see
subdirectory "config" for how the current targets are supported).

mpr requires GNU malloc in addition to some standard Unix utilities (awk,
sed, nm, sort, cut). A copy of GNU malloc is included in subdirectory
"malloc".  If you wish to use the "-f" and "-l" options of the tool "mpr"
(to see file/line information), you will also need the GNU debugger GDB.

INSTALLATION:

        - Installation requires you to create the library libmpr.a, against
          which you can link your applications.

        - You have a few choices when compiling libmpr.a:

                - Enable an automatic call to the mpr initialization routine
                  mpr() on the first call to malloc(). This has the benefit
                  of not requiring you to edit your application to call
                  mpr() - you can simply link your application with libmpr.a.
                  More importantly, this enables mpr to track calls to malloc()
                  that occur before main() (e.g. C++ constructors).

                - Enable an automatic call to GNU malloc's memory checking
                  routine mcheck() on the first call to malloc() (see DOC).

          By default, automatic calls to both mpr() and mcheck() are enabled.
          To disable either, add -UAUTOMPR or -UAUTOMCHECK to CCFLAGS before
          invoking make (see below). In this case, you will have to edit your
          application to add calls to mpr() and/or mcheck().

        - For appropriate target, type
                % ./configure target

        - If you are running sco5 and using the sco5 C compiler, type
                % CCFLAGS=-Xc make

          If you are running sco3 and using the sco3 C compiler, type
                % CCFLAGS=-ansi make

          Else, type
                % make

          This should create the library libmpr.a.

See file "DOC" for documentation on how to use mpr, and subdirectory
"example" for an example application.

mpr is inspired by Benjamin Zorn's memory profiler mprof.

For information on other memory allocation debugging packages see
"The Dynamic Storage Allocation Information Repository" maintained by
Benjamin Zorn at http://www.cs.colorado.edu/~zorn/DSA.html.

mpr was designed to be simple and easy to use - please keep it that way.

Please send all bug reports and suggestions to

    taj@intergate.bc.ca (Taj Khattra)
