⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memory.n

📁 tcl是工具命令语言
💻 N
字号:
'\"'\" Copyright (c) 1992-1999 by Karl Lehenbauer and Mark Diekhans'\" Copyright (c) 2000 by Scriptics Corporation.'\" All rights reserved.'\" '\" RCS: @(#) $Id: memory.n,v 1.5 2002/11/15 15:34:17 dkf Exp $'\" .so man.macros.TH memory n 8.1 Tcl "Tcl Built-In Commands".BS.SH NAMEmemory \- Control Tcl memory debugging capabilities..SH SYNOPSIS\fBmemory \fIoption \fR?\fIarg arg ...\fR?.BE.SH DESCRIPTION.PPThe \fBmemory\fR command gives the Tcl developer control of Tcl's memorydebugging capabilities.  The memory command has several suboptions, which aredescribed below.  It is only available when Tcl has been compiled withmemory debugging enabled (when \fBTCL_MEM_DEBUG\fR is defined atcompile time), and after \fBTcl_InitMemory\fR has been called..TP\fBmemory active\fR \fIfile\fRWrite a list of all currently allocated memory to the specified \fIfile\fR..TP\fBmemory break_on_malloc\fR \fIcount\fRAfter the \fIcount\fR allocations have been performed, \fBckalloc\fRoutputs a message to this effect and that it is now attempting to enterthe C debugger.  Tcl will then issue a \fISIGINT\fR signal against itself.If you are running Tcl under a C debugger, it should then enter the debuggercommand mode..TP\fBmemory info\fRReturns a report containing the total allocations and frees since Tcl began, the current packets allocated (the currentnumber of calls to \fBckalloc\fR not met by a corresponding call to \fBckfree\fR), the current bytes allocated, and the maximum numberof packets and bytes allocated..TP\fB memory init [on|off]\fRTurn on or off the pre-initialization of all allocated memorywith bogus bytes.  Useful for detecting the use of uninitialized values..TP\fBmemory onexit\fR \fIfile\fRCauses a list of all allocated memory to be written to the specified \fIfile\fRduring the finalization of Tcl's memory subsystem.  Useful for checkingthat memory is properly cleaned up during process exit..TP\fBmemory tag\fR \fIstring\fREach packet of memory allocated by \fBckalloc\fR can have associatedwith it a string-valued tag.  In the lists of allocated memory generatedby \fBmemory active\fR and \fBmemory onexit\fR, the tag for each packetis printed along with other information about the packet.  The\fBmemory tag\fR command sets the tag value for subsequent callsto \fBckalloc\fR to be \fIstring\fR.  .TP\fBmemory trace [on|off]\fR.brTurns memory tracing on or off.  When memory tracing is on, every callto \fBckalloc\fR causes a line of trace information to be written to\fIstderr\fR, consisting of the word \fIckalloc\fR, followed by theaddress returned, the amount of memory allocated, and the C filenameand line number of the code performing the allocation.  For example:.RS.CSckalloc 40e478 98 tclProc.c 1406.CECalls to \fBckfree\fR are traced in the same manner..RE.TP\fBmemory trace_on_at_malloc\fR \fIcount\fREnable memory tracing after \fIcount\fR \fBckalloc\fR's have been performed.For example, if you enter \fBmemory trace_on_at_malloc 100\fR,after the 100th call to \fBckalloc\fR, memory trace information will beginbeing displayed for all allocations and frees.  Since there can be a lotof memory activity before a problem occurs, judicious use of this optioncan reduce the slowdown caused by tracing (and the amount of trace informationproduced), if you can identify a number of allocations that occur beforethe problem sets in.  The current number of memory allocations that have occurred since Tcl started is printed on a guard zone failure..TP\fBmemory validate [on|off]\fRTurns memory validation on or off. When memory validation is enabled,on every call to \fBckalloc\fR or \fBckfree\fR, the guard zones arechecked for every piece of memory currently in existence that wasallocated by \fBckalloc\fR.  This has a large performance impact andshould only be used when overwrite problems are strongly suspected.The advantage of enabling memory validation is that a guard zoneoverwrite can be detected on the first call to \fBckalloc\fR or\fBckfree\fR after the overwrite occurred, rather than when thespecific memory with the overwritten guard zone(s) is freed, which mayoccur long after the overwrite occurred..SH "SEE ALSO"ckalloc, ckfree, Tcl_ValidateAllMemory, Tcl_DumpActiveMemory, TCL_MEM_DEBUG.SH KEYWORDSmemory, debug

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -