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