summaryrefslogtreecommitdiffstats
path: root/man3/mtrace.3
diff options
context:
space:
mode:
Diffstat (limited to 'man3/mtrace.3')
-rw-r--r--man3/mtrace.323
1 files changed, 11 insertions, 12 deletions
diff --git a/man3/mtrace.3 b/man3/mtrace.3
index 442da6f..61e8251 100644
--- a/man3/mtrace.3
+++ b/man3/mtrace.3
@@ -3,7 +3,7 @@
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
-.TH mtrace 3 2023-07-20 "Linux man-pages 6.05.01"
+.TH mtrace 3 2024-02-26 "Linux man-pages 6.7"
.SH NAME
mtrace, muntrace \- malloc tracing
.SH LIBRARY
@@ -12,7 +12,7 @@ Standard C library
.SH SYNOPSIS
.nf
.B "#include <mcheck.h>"
-.PP
+.P
.B "void mtrace(void);"
.B "void muntrace(void);"
.fi
@@ -28,7 +28,7 @@ These hook functions record tracing information about memory allocation
and deallocation.
The tracing information can be used to discover memory leaks and
attempts to free nonallocated memory in a program.
-.PP
+.P
The
.BR muntrace ()
function disables the hook functions installed by
@@ -39,7 +39,7 @@ If no hook functions were successfully installed by
.BR mtrace (),
.BR muntrace ()
does nothing.
-.PP
+.P
When
.BR mtrace ()
is called, it checks the value of the environment variable
@@ -47,7 +47,7 @@ is called, it checks the value of the environment variable
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
+.P
If
.B MALLOC_TRACE
is not set,
@@ -75,7 +75,6 @@ T{
.BR muntrace ()
T} Thread safety MT-Unsafe
.TE
-.sp 1
.\" FIXME: The marking is different from that in the glibc manual,
.\" markings in glibc manual are more detailed:
.\"
@@ -93,7 +92,7 @@ In normal usage,
is called once at the start of execution of a program, and
.BR muntrace ()
is never called.
-.PP
+.P
The tracing output produced after a call to
.BR mtrace ()
is textual, but not designed to be human readable.
@@ -103,7 +102,7 @@ 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
+.P
The tracing performed by
.BR mtrace ()
incurs a performance penalty (if
@@ -122,7 +121,7 @@ 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
+.P
.in +4n
.RB "$ " "cat t_mtrace.c"
.\" SRC BEGIN (t_mtrace.c)
@@ -145,11 +144,11 @@ main(void)
.EE
.\" SRC END
.in
-.PP
+.P
When we run the program as follows, we see that
.BR mtrace ()
diagnosed memory leaks at two different locations in the program:
-.PP
+.P
.in +4n
.EX
.RB "$ " "cc \-g t_mtrace.c \-o t_mtrace"
@@ -164,7 +163,7 @@ Memory not freed:
0x084c9448 0x100 at /home/cecilia/t_mtrace.c:16
.EE
.in
-.PP
+.P
The first two messages about unfreed memory correspond to the two
.BR malloc (3)
calls inside the