diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2021-04-25 10:56:32 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2021-04-25 10:56:32 (GMT) |
commit | 2453c29945269ab4734362d7613c187d3e6e8fbb (patch) | |
tree | 77821fc1dbeb54aa2be647250bc7cef1a712d7a7 /doc/Object.3 | |
parent | 8a32e272a433d0d1c70502e85cff49464d5e50ce (diff) | |
download | tcl-2453c29945269ab4734362d7613c187d3e6e8fbb.zip tcl-2453c29945269ab4734362d7613c187d3e6e8fbb.tar.gz tcl-2453c29945269ab4734362d7613c187d3e6e8fbb.tar.bz2 |
Documenting our reference count management
Diffstat (limited to 'doc/Object.3')
-rw-r--r-- | doc/Object.3 | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/doc/Object.3 b/doc/Object.3 index eadd041..2099552 100644 --- a/doc/Object.3 +++ b/doc/Object.3 @@ -283,7 +283,12 @@ to reduce storage requirements. Reference counting is used to determine when a value is no longer needed and can safely be freed. A value just created by \fBTcl_NewObj\fR or \fBTcl_NewStringObj\fR -has \fIrefCount\fR 0. +has \fIrefCount\fR 0, meaning that the object can often be given to a function +like \fBTcl_SetObjResult\fR, \fBTcl_ListObjAppendElement\fR, or +\fBTcl_DictObjPut\fR (as a value) without explicit reference management, all +of which are common use cases. (The latter two require that the the target +list or dictionary be well-formed, but that is often easy to arrange when the +value is being initially constructed.) The macro \fBTcl_IncrRefCount\fR increments the reference count when a new reference to the value is created. The macro \fBTcl_DecrRefCount\fR decrements the count |