## Tcl8.6.17/Tk8.6.17 Documentation > [incr Tcl] Package C API, version 4.3.4 > Preserve

### Tcl/Tk Applications | Tcl Commands | Tk Commands | [incr Tcl] Package Commands | SQLite3 Package Commands | TDBC Package Commands | tdbc::mysql Package Commands | tdbc::odbc Package Commands | tdbc::postgres Package Commands | tdbc::sqlite3 Package Commands | Thread Package Commands | Tcl C API | Tk C API | [incr Tcl] Package C API | TDBC Package C API

### NAME

Itcl_Alloc, Itcl_Free, Itcl_PreserveData, Itcl_ReleaseData, Itcl_EventuallyFree — Itcl リスト対象の操作　　　Manipulate an Itcl list object.

### SYNOPSIS

#include <itcl.h>
void *
Itcl_Alloc(size)
void
Itcl_PreserveData(ptr)
void
Itcl_ReleaseData(ptr)
void
Itcl_EventuallyFree(ptr, fproc)
void
Itcl_Free(ptr)

### 引数 ARGUMENTS

size_t size (入力in)
  割当るべきバイトの個数｡ Number of bytes to allocate.

void *ptr (入力in)
  Itcl_Alloc によって割当てられた値への指示子｡ Pointer value allocated by Itcl_Alloc.

Tcl_FreeProc *fproc (入力in)
  区域が解放された時に呼出すべき函数の番地｡　　　 Address of function to call when the block is to be freed.

### 説明 DESCRIPTION

これらの手続き函数は記憶域の､特に複数の独立した構成単位によって使われる記憶域の塊の､割当てと解放に使われる｡それらは､公共の Tcl 対話機能､ Tcl_Alloc, Tcl_Free, Tcl_Preserve, Tcl_Release, and Tcl_EventuallyFree 内の業務譜への機能と似ている｡Tcl 業務譜は 管理される塊の個数が多くなるに従って変動する性能の問題の影響を受ける｡ Itcl の設備はこれらの変動する性能の問題に遭遇し､それに影響されない代替品を要求する｡ These procedures are used to allocate and release memory, especially blocks of memory that will be used by multiple independent modules. They are similar in function to the routines in the public Tcl interface, Tcl_Alloc, Tcl_Free, Tcl_Preserve, Tcl_Release, and Tcl_EventuallyFree. The Tcl routines suffer from issues with performance scaling as the number of blocks managed grows large. The facilities of Itcl encounter these performance scaling issues and require an alternative that does not suffer from them.

Itcl_Alloc は 最小の寸法のバイトの割当てられた記憶域の塊への型のない指示子を返す｡全ての寸法バイトは零に初期化される｡ Itcl_Alloc returns an untyped pointer to an allocated block of memory of at least size bytes. All size bytes are initialized to zero.

構成単位譜は､Itcl_Alloc によって割当てられた指示子 ptr ついて､その構成単位譜がそこに関与が残っている間に割当て廃止されない様に Itcl_PreserveData を呼出す｡ A module calls Itcl_PreserveData on a pointer ptr allocated by Itcl_Alloc to prevent deallocation of that memory while the module remains interested in it.

構成単位譜は､以前に Itcl_PreserveData によって保存した指示子 ptr 上に､もはや構成単位が記憶域内のその塊内に関与せず､且つ､その割当て解除によって動揺しないことを指し示す為に､ Itcl_ReleaseData を呼出す｡ A module calls Itcl_ReleaseData on a pointer ptr previously preserved by Itcl_PreserveData to indicate the module no longer has an interest in the block of memory, and will not be disturbed by its deallocation.

Itcl_EventuallyFree は Itcl_Alloc によって割当てられた指示子 ptr 上に呼出されて､ ptr 上の Itcl_ReleaseData への呼出し数が ptr 上への Itcl_PreserveData への呼出の数に合致した時に呼出されるべく､割当て解除業務譜の fproc を登録する｡ ptr 上の Itcl_ReleaseData への呼出し数が ptr 上への Itcl_PreserveData への呼出の数に合致した時に呼出されるべく､割当て解除業務譜の fproc を登録する｡ Itcl_EventuallyFree is called on a pointer ptr allocated by Itcl_Alloc to register a deallocation routine fproc to be called when the number of calls to Itcl_ReleaseData on ptr matches the number of calls to Itcl_PreserveData on ptr. This condition indicates all modules have ended their interest in the block of memory and a call to fproc with argument ptr will deallocate the memory that no module needs anymore.

Itcl_Free は､ Itcl_Alloc によって割当てられた ptr 値に関する割当て解除業務譜である｡それは､どの ptr からも､Itcl_ReleaseData 呼出しによって合致しない Itcl_PreserveData 呼出しの履歴なしに呼出される｡ Itcl_EventuallyFree への fproc 引数として､或はその様な fproc 業務譜内部から呼出される業務譜として使用するのが最適である｡値が Itcl_PreserveData や Itcl_EventuallyFree に渡されないことが確認できた時に ptr 値を割当て解除することに使われ得る｡ Itcl_Free is a deallocation routine for a ptr value allocated by Itcl_Alloc. It may be called on any ptr with no history of an Itcl_PreserveData call unmatched by an Itcl_ReleaseData call. It is best used as an fproc argument to Itcl_EventuallyFree or as a routine called from within such an fproc routine. It can also be used to deallocate a ptr value when it can be assured that value has never been passed to Itcl_PreserveData or Itcl_EventuallyFree.

### KEYWORDS

free, memory
Copyright © 1993-1998 Lucent Technologies, Inc.