| 1 |
'\" |
| 2 |
'\" Copyright (c) 1992-1999 Karl Lehenbauer & Mark Diekhans. |
| 3 |
'\" Copyright (c) 2000 Scriptics Corporation. |
| 4 |
'\" All rights reserved. |
| 5 |
'\" |
| 6 |
.TH "Tcl_DumpActiveMemory" 3 8.1 Tcl "Tcl Library Procedures" |
| 7 |
.so man.macros |
| 8 |
.BS |
| 9 |
.SH NAME |
| 10 |
Tcl_DumpActiveMemory, Tcl_InitMemory, Tcl_ValidateAllMemory \- Validated memory allocation interface |
| 11 |
.SH SYNOPSIS |
| 12 |
.nf |
| 13 |
\fB#include <tcl.h>\fR |
| 14 |
.sp |
| 15 |
int |
| 16 |
\fBTcl_DumpActiveMemory\fR(\fIfileName\fR) |
| 17 |
.sp |
| 18 |
void |
| 19 |
\fBTcl_InitMemory\fR(\fIinterp\fR) |
| 20 |
.sp |
| 21 |
void |
| 22 |
\fBTcl_ValidateAllMemory\fR(\fIfileName, line\fR) |
| 23 |
|
| 24 |
.SH ARGUMENTS |
| 25 |
.AS Tcl_Interp *fileName |
| 26 |
.AP Tcl_Interp *interp in |
| 27 |
Tcl interpreter in which to add commands. |
| 28 |
.AP "const char" *fileName in |
| 29 |
For \fBTcl_DumpActiveMemory\fR, name of the file to which memory |
| 30 |
information will be written. For \fBTcl_ValidateAllMemory\fR, name of |
| 31 |
the file from which the call is being made (normally \fB__FILE__\fR). |
| 32 |
.AP int line in |
| 33 |
Line number at which the call to \fBTcl_ValidateAllMemory\fR is made |
| 34 |
(normally \fB__LINE__\fR). |
| 35 |
.BE |
| 36 |
|
| 37 |
.SH DESCRIPTION |
| 38 |
These functions provide access to Tcl memory debugging information. |
| 39 |
They are only functional when Tcl has been compiled with |
| 40 |
\fBTCL_MEM_DEBUG\fR defined at compile-time. When \fBTCL_MEM_DEBUG\fR |
| 41 |
is not defined, these functions are all no-ops. |
| 42 |
.PP |
| 43 |
\fBTcl_DumpActiveMemory\fR will output a list of all currently |
| 44 |
allocated memory to the specified file. The information output for |
| 45 |
each allocated block of memory is: starting and ending addresses |
| 46 |
(excluding guard zone), size, source file where \fBckalloc\fR was |
| 47 |
called to allocate the block and line number in that file. It is |
| 48 |
especially useful to call \fBTcl_DumpActiveMemory\fR after the Tcl |
| 49 |
interpreter has been deleted. |
| 50 |
.PP |
| 51 |
\fBTcl_InitMemory\fR adds the Tcl \fBmemory\fR command to the |
| 52 |
interpreter given by \fIinterp\fR. \fBTcl_InitMemory\fR is called |
| 53 |
by \fBTcl_Main\fR. |
| 54 |
.PP |
| 55 |
\fBTcl_ValidateAllMemory\fR forces a validation of the guard zones of |
| 56 |
all currently allocated blocks of memory. Normally validation of a |
| 57 |
block occurs when its freed, unless full validation is enabled, in |
| 58 |
which case validation of all blocks occurs when \fBckalloc\fR and |
| 59 |
\fBckfree\fR are called. This function forces the validation to occur |
| 60 |
at any point. |
| 61 |
|
| 62 |
.SH "SEE ALSO" |
| 63 |
TCL_MEM_DEBUG, memory |
| 64 |
|
| 65 |
.SH KEYWORDS |
| 66 |
memory, debug |
| 67 |
|
| 68 |
|