forked from johannesgerer/jburkardt-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
valgrind.html
158 lines (133 loc) · 3.91 KB
/
valgrind.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<html>
<head>
<title>
VALGRIND - C++ Examples of the VALGRIND Memory Leak Detector
</title>
</head>
<body bgcolor="#EEEEEE" link="#CC0000" alink="#FF3300" vlink="#000055">
<h1 align = "center">
VALGRIND <br> C++ Examples of the VALGRIND Memory Leak Detector
</h1>
<hr>
<p>
<b>VALGRIND</b>
is a directory of C++ programs which
illustrate the use of VALGRIND, a suite of programs which includes
a memory leak detector.
</p>
<p>
The simplest way to use VALGRIND on a program that is suspected of having
memory leaks is to compile with the "-g" option, and then issue the VALGRIND
command followed by the normal execution command:
<pre>
g++ -g myprog.C
mv a.out myprog
valgrind myprog
</pre>
</p>
<p>
On a Macintosh, it is necessary to include a particular switch that
generates the necessary symbol tables in order that VALGRIND can report
line numbers.
<pre>
valgrind --dsymutil=yes myprog
</pre>
</p>
<p>
Essentially, VALGRIND runs the program, but constantly watches to detect
illegal memory references, and prints messages when these are spotted.
</p>
<h3 align = "center">
Licensing:
</h3>
<p>
The computer code and data files described and made available on this web page
are distributed under
<a href = "../../txt/gnu_lgpl.txt">the GNU LGPL license.</a>
</p>
<h3 align = "center">
Languages:
</h3>
<p>
<b>VALGRIND</b> examples are available in
<a href = "../../c_src/valgrind/valgrind.html">a C version</a> and
<a href = "../../cpp_src/valgrind/valgrind.html">a C++ version</a> and
<a href = "../../f77_src/valgrind/valgrind.html">a FORTRAN77 version</a>.
<a href = "../../f_src/valgrind/valgrind.html">a FORTRAN90 version</a>.
</p>
<h3 align = "center">
Related Data and Programs:
</h3>
<p>
<a href = "../../f_src/gdb/gdb.html">
GDB</a>,
FORTRAN90 programs which
illustrate the use of the GNU debugger program
on a FORTRAN90 program;
</p>
<h3 align = "center">
Reference:
</h3>
<p>
<ol>
<li>
Julian Seward, et al,<br>
Valgrind Documentation.
</li>
</ol>
</p>
<h3 align = "center">
Examples and Tests:
</h3>
<p>
<b>TEST01</b> is an example in which 11 elements of the Fibonacci sequence
are stored in a vector allocated only for 10 elements:
<ul>
<li>
<a href = "test01.cpp">test01.cpp</a>, the calling program;
</li>
<li>
<a href = "test01.sh">test01.sh</a>, commands to
compile, link and run the sample calling program;
</li>
<li>
<a href = "test01_output.txt">test01_output.txt</a>,
the output file.
</li>
<li>
<a href = "test01_valgrind_output.txt">test01_valgrind_output.txt</a>,
the output file using VALGRIND.
</li>
</ul>
</p>
<p>
<b>TEST02</b> is an example in which some uninitialized data is accessed.
<ul>
<li>
<a href = "test02.cpp">test02.cpp</a>, the calling program;
</li>
<li>
<a href = "test02.sh">test02.sh</a>, commands to
compile, link and run the sample calling program;
</li>
<li>
<a href = "test02_output.txt">test02_output.txt</a>,
the output file.
</li>
<li>
<a href = "test02_valgrind_output.txt">test02_valgrind_output.txt</a>,
the output file using VALGRIND.
</li>
</ul>
</p>
<p>
You can go up one level to <a href = "../cpp_src.html">
the C++ source codes</a>.
</p>
<hr>
<i>
Last revised on 19 May 2011.
</i>
<!-- John Burkardt -->
</body>
</html>