Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / amd64 / man / mann / memory.n
CommitLineData
920dae64
AT
1'\"
2'\" Copyright (c) 1992-1999 by Karl Lehenbauer and Mark Diekhans
3'\" Copyright (c) 2000 by Scriptics Corporation.
4'\" All rights reserved.
5'\"
6'\" RCS: @(#) $Id: memory.n,v 1.5 2002/11/15 15:34:17 dkf Exp $
7'\"
8'\" The definitions below are for supplemental macros used in Tcl/Tk
9'\" manual entries.
10'\"
11'\" .AP type name in/out ?indent?
12'\" Start paragraph describing an argument to a library procedure.
13'\" type is type of argument (int, etc.), in/out is either "in", "out",
14'\" or "in/out" to describe whether procedure reads or modifies arg,
15'\" and indent is equivalent to second arg of .IP (shouldn't ever be
16'\" needed; use .AS below instead)
17'\"
18'\" .AS ?type? ?name?
19'\" Give maximum sizes of arguments for setting tab stops. Type and
20'\" name are examples of largest possible arguments that will be passed
21'\" to .AP later. If args are omitted, default tab stops are used.
22'\"
23'\" .BS
24'\" Start box enclosure. From here until next .BE, everything will be
25'\" enclosed in one large box.
26'\"
27'\" .BE
28'\" End of box enclosure.
29'\"
30'\" .CS
31'\" Begin code excerpt.
32'\"
33'\" .CE
34'\" End code excerpt.
35'\"
36'\" .VS ?version? ?br?
37'\" Begin vertical sidebar, for use in marking newly-changed parts
38'\" of man pages. The first argument is ignored and used for recording
39'\" the version when the .VS was added, so that the sidebars can be
40'\" found and removed when they reach a certain age. If another argument
41'\" is present, then a line break is forced before starting the sidebar.
42'\"
43'\" .VE
44'\" End of vertical sidebar.
45'\"
46'\" .DS
47'\" Begin an indented unfilled display.
48'\"
49'\" .DE
50'\" End of indented unfilled display.
51'\"
52'\" .SO
53'\" Start of list of standard options for a Tk widget. The
54'\" options follow on successive lines, in four columns separated
55'\" by tabs.
56'\"
57'\" .SE
58'\" End of list of standard options for a Tk widget.
59'\"
60'\" .OP cmdName dbName dbClass
61'\" Start of description of a specific option. cmdName gives the
62'\" option's name as specified in the class command, dbName gives
63'\" the option's name in the option database, and dbClass gives
64'\" the option's class in the option database.
65'\"
66'\" .UL arg1 arg2
67'\" Print arg1 underlined, then print arg2 normally.
68'\"
69'\" RCS: @(#) $Id: man.macros,v 1.4 2000/08/25 06:18:32 ericm Exp $
70'\"
71'\" # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
72.if t .wh -1.3i ^B
73.nr ^l \n(.l
74.ad b
75'\" # Start an argument description
76.de AP
77.ie !"\\$4"" .TP \\$4
78.el \{\
79. ie !"\\$2"" .TP \\n()Cu
80. el .TP 15
81.\}
82.ta \\n()Au \\n()Bu
83.ie !"\\$3"" \{\
84\&\\$1 \\fI\\$2\\fP (\\$3)
85.\".b
86.\}
87.el \{\
88.br
89.ie !"\\$2"" \{\
90\&\\$1 \\fI\\$2\\fP
91.\}
92.el \{\
93\&\\fI\\$1\\fP
94.\}
95.\}
96..
97'\" # define tabbing values for .AP
98.de AS
99.nr )A 10n
100.if !"\\$1"" .nr )A \\w'\\$1'u+3n
101.nr )B \\n()Au+15n
102.\"
103.if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
104.nr )C \\n()Bu+\\w'(in/out)'u+2n
105..
106.AS Tcl_Interp Tcl_CreateInterp in/out
107'\" # BS - start boxed text
108'\" # ^y = starting y location
109'\" # ^b = 1
110.de BS
111.br
112.mk ^y
113.nr ^b 1u
114.if n .nf
115.if n .ti 0
116.if n \l'\\n(.lu\(ul'
117.if n .fi
118..
119'\" # BE - end boxed text (draw box now)
120.de BE
121.nf
122.ti 0
123.mk ^t
124.ie n \l'\\n(^lu\(ul'
125.el \{\
126.\" Draw four-sided box normally, but don't draw top of
127.\" box if the box started on an earlier page.
128.ie !\\n(^b-1 \{\
129\h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
130.\}
131.el \}\
132\h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
133.\}
134.\}
135.fi
136.br
137.nr ^b 0
138..
139'\" # VS - start vertical sidebar
140'\" # ^Y = starting y location
141'\" # ^v = 1 (for troff; for nroff this doesn't matter)
142.de VS
143.if !"\\$2"" .br
144.mk ^Y
145.ie n 'mc \s12\(br\s0
146.el .nr ^v 1u
147..
148'\" # VE - end of vertical sidebar
149.de VE
150.ie n 'mc
151.el \{\
152.ev 2
153.nf
154.ti 0
155.mk ^t
156\h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
157.sp -1
158.fi
159.ev
160.\}
161.nr ^v 0
162..
163'\" # Special macro to handle page bottom: finish off current
164'\" # box/sidebar if in box/sidebar mode, then invoked standard
165'\" # page bottom macro.
166.de ^B
167.ev 2
168'ti 0
169'nf
170.mk ^t
171.if \\n(^b \{\
172.\" Draw three-sided box if this is the box's first page,
173.\" draw two sides but no top otherwise.
174.ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
175.el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
176.\}
177.if \\n(^v \{\
178.nr ^x \\n(^tu+1v-\\n(^Yu
179\kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
180.\}
181.bp
182'fi
183.ev
184.if \\n(^b \{\
185.mk ^y
186.nr ^b 2
187.\}
188.if \\n(^v \{\
189.mk ^Y
190.\}
191..
192'\" # DS - begin display
193.de DS
194.RS
195.nf
196.sp
197..
198'\" # DE - end display
199.de DE
200.fi
201.RE
202.sp
203..
204'\" # SO - start of list of standard options
205.de SO
206.SH "STANDARD OPTIONS"
207.LP
208.nf
209.ta 5.5c 11c
210.ft B
211..
212'\" # SE - end of list of standard options
213.de SE
214.fi
215.ft R
216.LP
217See the \\fBoptions\\fR manual entry for details on the standard options.
218..
219'\" # OP - start of full description for a single option
220.de OP
221.LP
222.nf
223.ta 4c
224Command-Line Name: \\fB\\$1\\fR
225Database Name: \\fB\\$2\\fR
226Database Class: \\fB\\$3\\fR
227.fi
228.IP
229..
230'\" # CS - begin code excerpt
231.de CS
232.RS
233.nf
234.ta .25i .5i .75i 1i
235..
236'\" # CE - end code excerpt
237.de CE
238.fi
239.RE
240..
241.de UL
242\\$1\l'|0\(ul'\\$2
243..
244.TH memory n 8.1 Tcl "Tcl Built-In Commands"
245.BS
246.SH NAME
247memory \- Control Tcl memory debugging capabilities.
248.SH SYNOPSIS
249\fBmemory \fIoption \fR?\fIarg arg ...\fR?
250.BE
251
252.SH DESCRIPTION
253.PP
254The \fBmemory\fR command gives the Tcl developer control of Tcl's memory
255debugging capabilities. The memory command has several suboptions, which are
256described below. It is only available when Tcl has been compiled with
257memory debugging enabled (when \fBTCL_MEM_DEBUG\fR is defined at
258compile time), and after \fBTcl_InitMemory\fR has been called.
259.TP
260\fBmemory active\fR \fIfile\fR
261Write a list of all currently allocated memory to the specified \fIfile\fR.
262.TP
263\fBmemory break_on_malloc\fR \fIcount\fR
264After the \fIcount\fR allocations have been performed, \fBckalloc\fR
265outputs a message to this effect and that it is now attempting to enter
266the C debugger. Tcl will then issue a \fISIGINT\fR signal against itself.
267If you are running Tcl under a C debugger, it should then enter the debugger
268command mode.
269.TP
270\fBmemory info\fR
271Returns a report containing the total allocations and frees since
272Tcl began, the current packets allocated (the current
273number of calls to \fBckalloc\fR not met by a corresponding call
274to \fBckfree\fR), the current bytes allocated, and the maximum number
275of packets and bytes allocated.
276.TP
277\fB memory init [on|off]\fR
278Turn on or off the pre-initialization of all allocated memory
279with bogus bytes. Useful for detecting the use of uninitialized values.
280.TP
281\fBmemory onexit\fR \fIfile\fR
282Causes a list of all allocated memory to be written to the specified \fIfile\fR
283during the finalization of Tcl's memory subsystem. Useful for checking
284that memory is properly cleaned up during process exit.
285.TP
286\fBmemory tag\fR \fIstring\fR
287Each packet of memory allocated by \fBckalloc\fR can have associated
288with it a string-valued tag. In the lists of allocated memory generated
289by \fBmemory active\fR and \fBmemory onexit\fR, the tag for each packet
290is printed along with other information about the packet. The
291\fBmemory tag\fR command sets the tag value for subsequent calls
292to \fBckalloc\fR to be \fIstring\fR.
293.TP
294\fBmemory trace [on|off]\fR
295.br
296Turns memory tracing on or off. When memory tracing is on, every call
297to \fBckalloc\fR causes a line of trace information to be written to
298\fIstderr\fR, consisting of the word \fIckalloc\fR, followed by the
299address returned, the amount of memory allocated, and the C filename
300and line number of the code performing the allocation. For example:
301.RS
302.CS
303ckalloc 40e478 98 tclProc.c 1406
304.CE
305Calls to \fBckfree\fR are traced in the same manner.
306.RE
307.TP
308\fBmemory trace_on_at_malloc\fR \fIcount\fR
309Enable memory tracing after \fIcount\fR \fBckalloc\fR's have been performed.
310For example, if you enter \fBmemory trace_on_at_malloc 100\fR,
311after the 100th call to \fBckalloc\fR, memory trace information will begin
312being displayed for all allocations and frees. Since there can be a lot
313of memory activity before a problem occurs, judicious use of this option
314can reduce the slowdown caused by tracing (and the amount of trace information
315produced), if you can identify a number of allocations that occur before
316the problem sets in. The current number of memory allocations that have
317occurred since Tcl started is printed on a guard zone failure.
318.TP
319\fBmemory validate [on|off]\fR
320Turns memory validation on or off. When memory validation is enabled,
321on every call to \fBckalloc\fR or \fBckfree\fR, the guard zones are
322checked for every piece of memory currently in existence that was
323allocated by \fBckalloc\fR. This has a large performance impact and
324should only be used when overwrite problems are strongly suspected.
325The advantage of enabling memory validation is that a guard zone
326overwrite can be detected on the first call to \fBckalloc\fR or
327\fBckfree\fR after the overwrite occurred, rather than when the
328specific memory with the overwritten guard zone(s) is freed, which may
329occur long after the overwrite occurred.
330
331.SH "SEE ALSO"
332ckalloc, ckfree, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory, TCL_MEM_DEBUG
333
334.SH KEYWORDS
335memory, debug