text
stringlengths 0
234
|
---|
the |
.br muntrace () |
function disables the hook functions installed by |
.br mtrace (), |
so that tracing information is no longer recorded |
for the memory-allocation functions. |
if no hook functions were successfully installed by |
.br mtrace (), |
.br muntrace () |
does nothing. |
.pp |
when |
.br mtrace () |
is called, it checks the value of the environment variable |
.br malloc_trace , |
which should contain the pathname of a file in which |
the tracing information is to be recorded. |
if the pathname is successfully opened, it is truncated to zero length. |
.pp |
if |
.br malloc_trace |
is not set, |
or the pathname it specifies is invalid or not writable, |
then no hook functions are installed, and |
.br mtrace () |
has no effect. |
in set-user-id and set-group-id programs, |
.br malloc_trace |
is ignored, and |
.br mtrace () |
has no effect. |
.sh attributes |
for an explanation of the terms used in this section, see |
.br attributes (7). |
.ad l |
.nh |
.ts |
allbox; |
lbx lb lb |
l l l. |
interface attribute value |
t{ |
.br mtrace (), |
.br muntrace () |
t} thread safety mt-unsafe |
.te |
.hy |
.ad |
.sp 1 |
.\" fixme: the marking is different from that in the glibc manual, |
.\" markings in glibc manual are more detailed: |
.\" |
.\" mtrace: mt-unsafe env race:mtrace const:malloc_hooks init |
.\" muntrace: mt-unsafe race:mtrace const:malloc_hooks locale |
.\" |
.\" but there is something wrong in glibc manual, for example: |
.\" glibc manual says muntrace should have marking locale because it calls |
.\" fprintf(), but muntrace does not execute area which cause locale problem. |
.sh conforming to |
these functions are gnu extensions. |
.sh notes |
in normal usage, |
.br mtrace () |
is called once at the start of execution of a program, and |
.br muntrace () |
is never called. |
.pp |
the tracing output produced after a call to |
.br mtrace () |
is textual, but not designed to be human readable. |
the gnu c library provides a perl script, |
.br mtrace (1), |
that interprets the trace log and produces human-readable output. |
for best results, |
the traced program should be compiled with debugging enabled, |
so that line-number information is recorded in the executable. |
.pp |
the tracing performed by |
.br mtrace () |
incurs a performance penalty (if |
.b malloc_trace |
points to a valid, writable pathname). |
.sh bugs |
the line-number information produced by |
.br mtrace (1) |
is not always precise: |
the line number references may refer to the previous or following (nonblank) |
line of the source code. |
.sh examples |
the shell session below demonstrates the use of the |
.br mtrace () |
function and the |
.br mtrace (1) |
command in a program that has memory leaks at two different locations. |
the demonstration uses the following program: |
.pp |
.in +4n |
.ex |
.rb "$ " "cat t_mtrace.c" |
#include <mcheck.h> |
Subsets and Splits