summaryrefslogtreecommitdiffstats
path: root/doc/TCL_MEM_DEBUG.3
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2007-10-28 14:17:38 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2007-10-28 14:17:38 (GMT)
commitccacc920f9cd610a9a9d8e800f623c20bf43a702 (patch)
treedaec40c266097bb1d38f10254010691b0131d4cc /doc/TCL_MEM_DEBUG.3
parent8ffb8fa76d0d34283e491044dd28385674ba113e (diff)
downloadtcl-ccacc920f9cd610a9a9d8e800f623c20bf43a702.zip
tcl-ccacc920f9cd610a9a9d8e800f623c20bf43a702.tar.gz
tcl-ccacc920f9cd610a9a9d8e800f623c20bf43a702.tar.bz2
First stage of doing GOOBE improvements to documentation now that the html generation works
Diffstat (limited to 'doc/TCL_MEM_DEBUG.3')
-rw-r--r--doc/TCL_MEM_DEBUG.329
1 files changed, 13 insertions, 16 deletions
diff --git a/doc/TCL_MEM_DEBUG.3 b/doc/TCL_MEM_DEBUG.3
index a0b87c2..d76cd91 100644
--- a/doc/TCL_MEM_DEBUG.3
+++ b/doc/TCL_MEM_DEBUG.3
@@ -3,7 +3,7 @@
'\" Copyright (c) 2000 by Scriptics Corporation.
'\" All rights reserved.
'\"
-'\" RCS: @(#) $Id: TCL_MEM_DEBUG.3,v 1.9 2007/10/26 20:11:52 dgp Exp $
+'\" RCS: @(#) $Id: TCL_MEM_DEBUG.3,v 1.10 2007/10/28 14:17:39 dkf Exp $
'\"
.so man.macros
.TH TCL_MEM_DEBUG 3 8.1 Tcl "Tcl Library Procedures"
@@ -11,14 +11,12 @@
.SH NAME
TCL_MEM_DEBUG \- Compile-time flag to enable Tcl memory debugging
.BE
-
.SH DESCRIPTION
When Tcl is compiled with \fBTCL_MEM_DEBUG\fR defined, a powerful set
of memory debugging aids is included in the compiled binary. This
includes C and Tcl functions which can aid with debugging
memory leaks, memory allocation overruns, and other memory related
errors.
-
.SH "ENABLING MEMORY DEBUGGING"
.PP
To enable memory debugging, Tcl should be recompiled from scratch with
@@ -36,28 +34,31 @@ Once memory debugging support has been compiled into Tcl, the C
functions \fBTcl_ValidateAllMemory\fR, and \fBTcl_DumpActiveMemory\fR,
and the Tcl \fBmemory\fR command can be used to validate and examine
memory usage.
-
.SH "GUARD ZONES"
.PP
When memory debugging is enabled, whenever a call to \fBckalloc\fR is
-made, slightly more memory than requested is allocated so the memory debugging
-code can keep track of the allocated memory, and eight-byte ``guard
-zones'' are placed in front of and behind the space that will be
+made, slightly more memory than requested is allocated so the memory
+debugging code can keep track of the allocated memory, and eight-byte
+.QW "guard zones"
+are placed in front of and behind the space that will be
returned to the caller. (The sizes of the guard zones are defined by the
C #define \fBLOW_GUARD_SIZE\fR and #define \fBHIGH_GUARD_SIZE\fR
-in the file \fIgeneric/tclCkalloc.c\fR -- it can
+in the file \fIgeneric/tclCkalloc.c\fR \(em it can
be extended if you suspect large overwrite problems, at some cost in
performance.) A known pattern is written into the guard zones and, on
a call to \fBckfree\fR, the guard zones of the space being freed are
checked to see if either zone has been modified in any way. If one
has been, the guard bytes and their new contents are identified, and a
-``low guard failed'' or ``high guard failed'' message is issued. The
-``guard failed'' message includes the address of the memory packet and
+.QW "low guard failed"
+or
+.QW "high guard failed"
+message is issued. The
+.QW "guard failed"
+message includes the address of the memory packet and
the file name and line number of the code that called \fBckfree\fR.
This allows you to detect the common sorts of one-off problems, where
not enough space was allocated to contain the data written, for
example.
-
.SH "DEBUGGING DIFFICULT MEMORY CORRUPTION PROBLEMS"
.PP
Normally, Tcl compiled with memory debugging enabled will make it easy
@@ -70,16 +71,12 @@ This will enable memory validation from the first call to
\fBckalloc\fR, again, at a large performance impact.
.PP
If you are desperate and validating memory on every call to
-\fBckalloc\fR and \fBckfree\fR isn't enough, you can explicitly call
+\fBckalloc\fR and \fBckfree\fR is not enough, you can explicitly call
\fBTcl_ValidateAllMemory\fR directly at any point. It takes a \fIchar
*\fR and an \fIint\fR which are normally the filename and line number
of the caller, but they can actually be anything you want. Remember
to remove the calls after you find the problem.
-
.SH "SEE ALSO"
ckalloc, memory, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory
-
.SH KEYWORDS
memory, debug
-
-