---
name: "mleak"
section: "1"
platform: "linux"
package: "mpatrolc2"
version: "1.4.8-11"
release: "Debian 4.0 (Etch)"
platforms: ["linux"]
url: "https://new.carta.tech/mleak"
---

# mleak(1)

locates memory leaks in an mpatrol log file

## NAME

mleak - locates memory leaks in an mpatrol log file

## SYNOPSIS

**mleak** \[*options*\] \[*file*\]

## DESCRIPTION

The **mleak** command is used to display all unfreed memory allocations from a log file produced by the mpatrol library.  This should be used if the mpatrol library could not finish writing the log file due to abnormal program termination (which would prevent the **SHOWUNFREED** option from working), but note that some of the unfreed allocations might have been freed if the program had terminated successfully.

The **mleak** command scans through an mpatrol log file looking for lines beginning with *ALLOC:* and *FREE:* but ignores lines beginning with *REALLOC:*, so only the **LOGALLOCS** and **LOGFREES** options are necessary when running a program linked with the mpatrol library.  Note that as a result of this, no attempt is made to account for resizing of memory allocations and so the total amount of memory used by the resulting unfreed allocations may not be entirely accurate.

This command will also read the unfreed allocations table produced by the **SHOWUNFREED** option in the log file if one is present.  The entries in the table will be compared with the currently allocated entries and will be added if not already present.

The *file* argument must be a valid mpatrol log filename but if *file* is omitted then **mleak** will use *mpatrol.log* as the name of the log file to use.  The **mleak** command makes two passes over the log file so the file must be randomly-accessable.  If *file* is given as *-* then the standard input file stream will be used as the log file.

## OPTIONS

- **--help** \[**-h**\]

  Displays a quick-reference option summary.

- **--ignore** \[**-i**\]

  Specifies that the list of unfreed allocations in the log file should be ignored.

- **--max-stack** *depth* \[**-n**\]

  Specifies the maximum stack depth to display for each unfreed memory allocation. If *depth* is *0* then the call stack depth will be unlimited in size. The default call stack depth is *0*.

- **--version** \[**-V**\]

  Displays the version number of the **mleak** command.

## SEE ALSO

[**mpatrol**(1)](/mpatrol/1.md), [**mprof**(1)](/mprof/1.md), [**mptrace**(1)](/mptrace/1.md), [**mpsym**(1)](/mpsym/1.md), [**mpedit**(1)](/mpedit/1.md), [**hexwords**(1)](/hexwords/1.md), [**libmpatrol**(3)](/libmpatrol/3.md), [**libmpalloc**(3)](/libmpalloc/3.md).

The mpatrol manual and reference card.

http://www.cbmamiga.demon.co.uk/mpatrol/

## AUTHOR

Graeme S. Roy \<graeme.roy@analog.com\>

## COPYRIGHT

Copyright (C) 1997-2002 Graeme S. Roy \<graeme.roy@analog.com\>

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
