#author("2017-05-25T21:43:16+09:00","default:haikikyou","haikikyou")
#author("2017-05-26T00:03:19+09:00","default:haikikyou","haikikyou")
[[PostgreSQL/開発]]

#contents

* 概要 [#d39eb51e]

- メモリアロケーションのユーティリティ機能

* 定義 [#x1a86688]

** マクロ [#qcffa5c6]

*** MaxAllocSize, MaxAllocHugeSize [#r5e25b72]

|~マクロ名|~説明|~値|h
|MaxAllocSize|アロケーションの最大サイズ(1G-1)。&br;pallocでは,このサイズがリミットである。&br;|(Size) 0x3fffffff|
|MaxAllocHugeSize|アロケーションの最大サイズ(SIZE_MAX/2)。&br;XXXHogeやXXX_huge系の関数ではこのリミットとなる。&br;|(Size) -1 >> 1|

このマクロ定数を直接使うシーンはあまりない。AllocHugeSizeIsValidやAllocSizeIsValidなどのチェックマクロがMemoryAllocXXXX関数で使われている。
*** AllocSizeIsValid, AllocHugeSizeIsValid [#o711b550]

#geshi(c){{{
#define AllocSizeIsValid(size)	((Size) (size) <= MaxAllocSize)
#define AllocHugeSizeIsValid(size)	((Size) (size) <= MaxAllocHugeSize)
}}}

サイズが最大サイズ以下かチェックする。
*** STANDARDCHUNKHEADERSIZE [#l8764aec]

#geshi(c){{{
#define STANDARDCHUNKHEADERSIZE  MAXALIGN(sizeof(StandardChunkHeader))
}}}

- メモリチャンクのアライメントされたヘッダサイズ
*** MemoryContextResetAndDeleteChildren [#u74855f2]

#geshi(c){{{
#define MemoryContextResetAndDeleteChildren(ctx) MemoryContextReset(ctx)
}}}

- MemoryContextReset関数を呼ぶ。後方互換のためのマクロ。
*** ALLOCSET_DEFAULT_XXXX [#i7676be1]

|~定数|~説明|~値|h
|ALLOCSET_DEFAULT_MINSIZE||0|
|ALLOCSET_DEFAULT_INITSIZE||(8 * 1024)|
|ALLOCSET_DEFAULT_MAXSIZE||(8 * 1024 * 1024)|

アロケーション時に使用する定型サイズのためのマクロ定数。

&size(12){&color(white,#00afcc){ サンプル };};
#geshi(c){{{
MemoryContext context = AllocSetContextCreate(CurrentMemoryContext,
                                              "my context",
                                              ALLOCSET_DEFAULT_MINSIZE,
                                              ALLOCSET_DEFAULT_INITSIZE,
                                              ALLOCSET_DEFAULT_MAXSIZE);
}}}
*** ALLOCSET_SMALL_XXXX [#x8b6a559]

|~定数|~説明|~値|h
|ALLOCSET_SMALL_MINSIZE||0|
|ALLOCSET_SMALL_INITSIZE||(1 * 1024)|
|ALLOCSET_SMALL_MAXSIZE||(8 * 1024)|

アロケーション時に使用する定型サイズのためのマクロ定数で,比較的小さな領域の場合。
*** ALLOCSET_SEPARATE_THRESHOLD [#v16bd8d2]

#geshi(c){{{
#define ALLOCSET_SEPARATE_THRESHOLD  8192
}}}

ALLOC_CHUNK_LIMIT(8192)と同じでなければならない。AllocSetContextのallocChunkLimitは最大でこの値となり,このサイズを超えるアロケーション要求は別々のブロックで確保される。

&size(12){&color(white,orange){ 参考 };}; 
- [[AllocSetContextCreate()>https://doxygen.postgresql.org/aset_8c.html#abf14e7d2d14df4e3afc8e795a695030a]] - on doxygen.postgresql.org
- [[tuplesort_begin_common()>https://doxygen.postgresql.org/tuplesort_8c.html#a2148ac4aa5d41e7b061505cbb364665e]] - on doxygen.postgresql.org
- [[tuplestore_begin_common()>https://doxygen.postgresql.org/tuplestore_8c.html#a6a91ce157962a04438dc146dc5da5137]] - on doxygen.postgresql.org
** 列挙型 [#a91733b0]

** 構造体 [#ea803668]

*** StandardChunkHeader [#oda1e6ac]

|~番号|~データ型|~フィールド|~説明|h
|1|MemoryContext|context|所属するコンテキスト|
|2|Size|size|メモリチャンクに割り当てられたサイズ(byte)|
|3|Size|requested_size|リクエストされたサイズ(byte)|
** 関数 [#u75fdaa2]

*** MemoryContextInit [#zfc402dc]

#geshi(c){{
extern void MemoryContextInit(void);
}}

- メモリコンテスト管理システムの初期化を行なう。
- postmasterのスタートアップ時に呼ばれるので,拡張機能などでこの関数を呼ぶケースはない(すでにメモリコンテキスト管理が利用できる状態になっているため)。
- この処理の中で,TopMemoryContextというメモリコンテキストツリーのトープレベルのメモリコンテキストとErrorContextが作成される。


&size(12){&color(white,orange){ 参考 };}; [[MemoryContextInit()>https://doxygen.postgresql.org/mcxt_8c.html#a90e9ce77120b687f9197ec3f42556e7b]] - on doxygen.postgresql.org
*** MemoryContextReset [#r2f7ee24]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
extern void MemoryContextReset(MemoryContext context);
}}

- 指定されたメモリコンテキスト及び子階層に割り当てられたメモリ領域を解放する。
- 子階層のメモリコンテキストに対しては,MemoryContextDelete()(AllocSetDelete())を再帰的に呼ぶ。
- 対象のメモリコンテキスト(context)については,MemoryContextResetOnly()(AllocSetReset())が呼ばれる。contextの最初のブロック(存在すれば)は残され,メモリチャンクは消去される(freeptrは先頭にポイントされる)。

&size(12){&color(white,orange){ 参考 };};
- [[AllocSetDelete()>https://doxygen.postgresql.org/aset_8c.html#a800b4ddef4d9f1bc24252d34af22971c]] - on doxygen.postgresql.org
- [[AllocSetReset()>https://doxygen.postgresql.org/aset_8c.html#a4184c05efdf010f2c86bb057f4bc41a9]] - on doxygen.postgresql.org
*** MemoryContextDelete [#j584a692]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
extern void MemoryContextDelete(MemoryContext context);
}}

- 指定されたメモリコンテキストのメモリ領域を解放する。
- 子階層のメモリコンテキストも再帰的に処理される。


&size(12){&color(white,orange){ 参考 };}; [[MemoryContextDelete()>https://doxygen.postgresql.org/mcxt_8c.html#adabf8bdc427b4e273e7445b4701f51f2]] - on doxygen.postgresql.org
*** MemoryContextResetOnly [#x6978405]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
extern void MemoryContextResetOnly(MemoryContext context);
}}

- 指定されたメモリコンテキストをリセットする(AllocSetReset()が呼ばれる)。
- 子階層のメモリコンテキストに対しては何もしない。

*** MemoryContextResetChildren [#g76807a0]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
extern void MemoryContextResetChildren(MemoryContext context);
}}

- 指定されたメモリコンテキストの子階層のメモリコンテキストに対して,再帰的にMemoryContextResetOnly関数を呼ぶ。
*** MemoryContextDeleteChildren [#q7ca2c17]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
extern void MemoryContextDeleteChildren(MemoryContext context);
}}

- 指定されたメモリコンテキストの子階層のメモリコンテキストに対して,再帰的にMemoryContextDelete関数を呼ぶ。

&size(12){&color(white,#00afcc){ サンプル };};
#geshi(c){{{
#define BLOCK_SIZE 1024 * 8

void reset_callback(void *arg)
{
    MemoryContext context = (MemoryContext)arg;
    elog(NOTICE, "%s will be deleted.", context->name);
}

void sample()
{
    MemoryContext oldcontext = NULL;
    MemoryContextCallback callback;
    MemoryContextCallback callback2;

    // init parent context
    MemoryContext parent_context = AllocSetContextCreate(CurrentMemoryContext,
                                                  "parent context",
                                                  0,
                                                  BLOCK_SIZE,
                                                  BLOCK_SIZE);

    callback.func = reset_callback;
    callback.arg = parent_context;
    MemoryContextRegisterResetCallback(parent_context, &callback);

    oldcontext = MemoryContextSwitchTo(parent_context);

    // parent context from here
    StringInfo strinfo = makeStringInfo();
    appendStringInfo(strinfo, "Hello %s", "Duke");
    elog(NOTICE, "%s", strinfo->data);

    // init child context
    MemoryContext child_context = AllocSetContextCreate(parent_context,
                                                  "child context",
                                                  0,
                                                  BLOCK_SIZE,
                                                  BLOCK_SIZE);
    callback2.func = reset_callback;
    callback2.arg = child_context;
    MemoryContextRegisterResetCallback(child_context, &callback2);

    MemoryContextSwitchTo(child_context);

    // child context from here
    StringInfo strinfo2 = makeStringInfo();
    appendStringInfo(strinfo2, "Hello %s", "Togo");
    elog(NOTICE, "%s", strinfo2->data);


    // switch back to original context.
    MemoryContextSwitchTo(oldcontext);

    // delete parent_context and child_context
    //
    //  CurrentMemoryContext
    //    |- parent_context     <--- delete
    //        |- child_context  <--- delete
    MemoryContextDeleteChildren(CurrentMemoryContext);
}
}}}
*** MemoryContextSetParent [#b9de69d5]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
// 引数2:新しい親となるメモリコンテキスト
extern void MemoryContextSetParent(MemoryContext context, MemoryContext new_parent);

/* Change a context to belong a new parent.

== Before ==
new_parent             current_parent
  |- context1            |- context <-- move to (o)
  |- context2            |- next_context

== After ==
new_parent             current_parent
  |- context (o)         |- next_context
  |- context1
  |- context2            
*/
}}

- 指定されたメモリコンテキスト(context)を新しいメモリコンテスト(new_parent)に付け替える。

&size(12){&color(white,orange){ 参考 };}; [[MemoryContextSetParent()>https://doxygen.postgresql.org/mcxt_8c.html#a38bd1f1dd1d024e312d5e5dabd68831d]] - on doxygen.postgresql.org
*** GetMemoryChunkSpace [#h49cf6cc]

#geshi(c){{
// 引数1:メモリチャンクのポインタ
// 戻り値:メモリチャンクサイズ(ヘッダ含む)
extern Size GetMemoryChunkSpace(void *pointer);
}}

- 指定されたメモリチャンクのサイズを返す(ヘッダサイズ含む)。


&size(12){&color(white,#00afcc){ サンプル };};
#geshi(c){{{
void test_chunk_space()
{
    elog(NOTICE, "STANDARDCHUNKHEADERSIZE = %d", STANDARDCHUNKHEADERSIZE);

    char *chunk1 = palloc(128); // 128 + STANDARDCHUNKHEADERSIZE
    elog(NOTICE, "%d", GetMemoryChunkSpace(chunk1)); // NOTICE:  152

    char *chunk2 = palloc(256-32); // 256 + STANDARDCHUNKHEADERSIZE
    elog(NOTICE, "%d", GetMemoryChunkSpace(chunk2)); // NOTICE:  280
}
}}}
*** GetMemoryChunkContext [#s051b011]

#geshi(c){{
// 引数1:メモリチャンクのポインタ
// 戻り値:メモリチャンクが属するメモリコンテキスト
extern MemoryContext GetMemoryChunkContext(void *pointer);
}}

- 指定されたメモリチャンクの所属するメモリコンテキストを返す。


&size(12){&color(white,#00afcc){ サンプル };};
#geshi(c){{{
void test_chunk()
{
    MemoryContext context = AllocSetContextCreate(CurrentMemoryContext,
                                                         "my context",
                                                         0,
                                                         1024 * 8,
                                                         1024 * 8);

    MemoryContext oldcontext = MemoryContextSwitchTo(context);
    StringInfo strinfo = makeStringInfo();
    elog(NOTICE, "%s", GetMemoryChunkContext(strinfo)->name); // NOTICE:  my contex

    MemoryContextSwitchTo(oldcontext);
    MemoryContextDelete(context);
}
}}}
*** MemoryContextGetParent [#o8a8b1a8]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
// 戻り値:contextの親のメモリコンテスト
extern MemoryContext MemoryContextGetParent(MemoryContext context);
}}

- 指定されたメモリコンテキストの親のメモリコンテキストを返す。


*** MemoryContextIsEmpty [#lac3b573]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
// 戻り値:true:空,false:空でない
extern bool MemoryContextIsEmpty(MemoryContext context);
}}

- 対象のメモリコンテストが空であるか否かを返す。
-- firstchildを持っていない場合はtrue。
--メモリコンテキストが新しい場合またはリセットされている場合はtrue。

&size(12){&color(white,orange){ 参考 };}; 
- [[AllocSetIsEmpty()>https://doxygen.postgresql.org/aset_8c.html#a4e07d97322537c87a4e33f13686e24bc]] - on doxygen.postgresql.org
- [[MemoryContextIsEmpty()>https://doxygen.postgresql.org/mcxt_8c.html#a1b1b3c0b50c290306a1e5eb88d1241f6]] - on doxygen.postgresql.org
*** MemoryContextStats [#p2c2599b]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
extern void MemoryContextStats(MemoryContext context);
}}

- 指定されたメモリコンテキストの統計情報を出力する。

&size(12){&color(white,#00afcc){ サンプル };};
#geshi(c){{{
void test_chunk()
{
    MemoryContext context = AllocSetContextCreate(CurrentMemoryContext,
                                                         "my context",
                                                         0,
                                                         1024 * 8,
                                                         1024 * 8);


    MemoryContext oldcontext = MemoryContextSwitchTo(context);
    StringInfo strinfo = makeStringInfo();
    elog(NOTICE, "%s", GetMemoryChunkContext(strinfo)->name); // NOTICE:  my contex

    MemoryContextStats(context);
    // my context: 8192 total in 1 blocks; 7056 free (0 chunks); 1136 used

    MemoryContextSwitchTo(oldcontext);
    MemoryContextDelete(context);
}
}}}

&size(12){&color(white,orange){ 参考 };}; [[MemoryContextStats()>https://doxygen.postgresql.org/mcxt_8c.html#a8e04497c2dd94b1e4a11b761bd27735c]] - on doxygen.postgresql.org
*** MemoryContextAllowInCriticalSection [#l9fe4341]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
// 引数2:クリティカルセクションのメモリアローケーションを許可するか否か
//      true:許可する,false:許可しない
extern void MemoryContextAllowInCriticalSection(MemoryContext context, bool allow);
}}

- 指定されたメモリコンテキストで,クリティカルセクション内でのメモリアロケーションの許可/不許可を設定する。
- デバッグ時に有効,一時的に許可など。

&size(12){&color(white,orange){ 参考 };}; [[palloc()>https://doxygen.postgresql.org/mcxt_8c.html#af25167ef63e16e1cbeb08b6f1f24e1d7]] - on doxygen.postgresql.org

&size(12){&color(white,#800080){ 実験 };};
#geshi(c){{{
//
// Debug, on enable assertion
//
void test_crit()
{
    MemoryContext context = AllocSetContextCreate(CurrentMemoryContext,
                                                  "my context",
                                                  0,
                                                  1024 * 8,
                                                  1024 * 8);
    MemoryContextAllowInCriticalSection(context, true); // 許可しない,trueだと下のpallocは成功する
    // context->allowInCritSection = false; // 許可しない,trueだと下のpallocは成功する
    MemoryContext oldcontext = MemoryContextSwitchTo(context);

    START_CRIT_SECTION();
    // クリティカルセクション内でのメモリアローケーションは通常許可されない
    void *chunk = palloc(128);
    // TRAP: FailedAssertion("!(CritSectionCount == 0 || (CurrentMemoryContext)->allowInCritSection)", File: "mcxt.c", Line: 818)
    END_CRIT_SECTION();

    MemoryContextSwitchTo(oldcontext);
    MemoryContextDelete(context);
}
}}}
*** MemoryContextCheck [#ka9bb5bd]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
extern void MemoryContextCheck(MemoryContext context);
}}

- デバッグ用の関数。
- ブロックリスト,チャンクを操作し整合性をチェックする。
- AllocSetCheck関数が呼ばれる。
*** MemoryContextContains [#n111b2d3]

#geshi(c){{
// 引数1:対象のメモリコンテキスト
// 引数2:メモリチャンクのポインタ
// 戻り値:true:含まれる,false:含まれない
extern bool MemoryContextContains(MemoryContext context, void *pointer);
}}

- メモリチャンクが指定されたメモリコンテキストに属するかを判定する。
- メモリチャンクのヘッダに登録されているメモリコンテキストが指定されたメモリコンテキストと等しいかチェックする。

&size(12){&color(white,orange){ 参考 };}; [[MemoryContextContains()>https://doxygen.postgresql.org/mcxt_8c.html#a91a5f76758e8559995c691a6de6849b2]] - on doxygen.postgresql.org

&size(12){&color(white,#00afcc){ サンプル };};
#geshi(c){{{
void test_chunk_contains()
{
    void *chunk = palloc(128);
    elog(NOTICE, "%d", MemoryContextContains(CurrentMemoryContext, chunk)); // NOTICE:  1
    pfree(chunk);
}
}}}
*** MemoryContextCreate [#a79de8dc]

#geshi(c){{
// 引数1:ノードタグ
// 引数2:メモリコンテキストのサイズ(byte)
// 引数3:メモリコンテキスト操作で使用される関数群
// 引数4:親のメモリコンテキスト
// 引数5:メモリコンテキスト名
// 戻り値:作成されたメモリコンテキスト
extern MemoryContext MemoryContextCreate(NodeTag tag, Size size,
					MemoryContextMethods *methods,
					MemoryContext parent,
					const char *name);
}}

- メモリコンテキストタイプ(tag)を指定して,メモリコンテストを作成する。通常のMemoryContextXXX関数は,T_AllocSetContextというタグが使われる。
- 最近のバージョンでは,slab.cという新しいメモリコンテキスト実装が追加されている。

&size(12){&color(white,orange){ 参考 };};
- [[slab.c>https://doxygen.postgresql.org/slab_8c.html]] - on doxygen.postgresql.org
- [[aset.c>https://doxygen.postgresql.org/aset_8c.html]] - on doxygen.postgresql.org
- [[AllocSetContextCreate()>https://doxygen.postgresql.org/memutils_8h.html#abf14e7d2d14df4e3afc8e795a695030a]] - on doxygen.postgresql.org

*** AllocSetContextCreate [#lc8a5772]

#geshi(c){{
// 引数1:親のメモリコンテキスト
// 引数2:メモリコンテキストの名前
// 引数3:最小のコンテキストサイズ
// 引数4:初期ブロックサイズ
// 引数5:最大ブロックサイズ
// 戻り値:作成されたメモリコンテキスト
extern MemoryContext AllocSetContextCreate(MemoryContext parent,
					  const char *name,
					  Size minContextSize,
					  Size initBlockSize,
					  Size maxBlockSize);
}}

- AllocSetContextを作成する。この中でMemoryContextCreate関数が呼ばれている。

&size(12){&color(white,#00afcc){ サンプル };};
#geshi(c){{{
void test_context_create()
{
    MemoryContext context = AllocSetContextCreate(CurrentMemoryContext,
                                                  "my context",
                                                  0,
                                                  1024 * 8,
                                                  1024 * 8);
}
}}}












* サンプルプログラム [#j0b18196]

#geshi(c){{
#define BLOCK_SIZE 1024 * 8

void sample()
{
    MemoryContext oldcontext = NULL;
    MemoryContextCallback callback;

    // init context
    MemoryContext context = AllocSetContextCreate(CurrentMemoryContext,
                                                  "my context",
                                                  0,
                                                  BLOCK_SIZE,
                                                  BLOCK_SIZE);

    // set reset callback
    callback.func = reset_callback;
    callback.arg = context;
    MemoryContextRegisterResetCallback(context, &callback);

    oldcontext = MemoryContextSwitchTo(context);

    // my context from here
    StringInfo strinfo = makeStringInfo();
    appendStringInfo(strinfo, "Hello %s", "Duke");
    elog(NOTICE, "%s", strinfo->data);

    // switch back to original context.
    MemoryContextSwitchTo(oldcontext);

    // delete context
    MemoryContextDelete(context);
}
}}


** メモリコンテキストのアロケーションとメモリチャンクの統計 [#td321539]

メモリコンテキストのアロケーションとメモリチャンクの統計を出力してみる。

&size(12){&color(white,#800080){ 実験 };};

#geshi(c){{{
#define ALLOCSET_NUM_FREELISTS	11

typedef struct AllocBlockData *AllocBlock;
typedef struct AllocChunkData *AllocChunk;

typedef struct AllocSetContext
{
    MemoryContextData header;
    AllocBlock	blocks;
    AllocChunk	freelist[ALLOCSET_NUM_FREELISTS];
    Size		initBlockSize;
    Size		maxBlockSize;
    Size		nextBlockSize;
    Size		allocChunkLimit;
    AllocBlock	keeper;
} AllocSetContext;
typedef AllocSetContext *AllocSet;

typedef struct AllocBlockData
{
    AllocSet	aset;
    AllocBlock	next;
    char	   *freeptr;
    char	   *endptr;
}	AllocBlockData;

typedef struct AllocChunkData
{
    void	   *aset;
    Size		size;
#ifdef MEMORY_CONTEXT_CHECKING
    Size		requested_size;
#endif
}	AllocChunkData;


// メモリコンテキストの使用状況を出力する
void show_context_stats(MemoryContext context)
{
    MemoryContextStats(context);

    MemoryContext tmp_context = AllocSetContextCreate(CurrentMemoryContext,
                                                  "temporary context",
                                                  0,
                                                  8192,
                                                  8192);
    MemoryContext oldcontext = MemoryContextSwitchTo(tmp_context);

    // show stats
    // ----------------
    AllocSet set = (AllocSet)context;
    AllocChunk chunk;
    elog(INFO, "%s", "***** freelist *****");
    StringInfo str = makeStringInfo();
    for (int i = 0; i < ALLOCSET_NUM_FREELISTS; i++) {
        chunk = set->freelist[i];
        if (chunk != NULL) {
            appendStringInfo(str, "chunk[%d] (size = %ld byte, requested_size = %ld byte, ", i, chunk->size, chunk->requested_size);
        } else {
            appendStringInfo(str, "chunk[%d] (), ", i);
        }
        elog(INFO, "%s", str->data);
        resetStringInfo(str);
    }
    // -----------------

    MemoryContextSwitchTo(oldcontext);
    MemoryContextDelete(tmp_context);
}

void test_context_limit()
{
    MemoryContext context = AllocSetContextCreate(CurrentMemoryContext,
                                                  "my context",
                                                  0,
                                                  8192,
                                                  8192);
    MemoryContext oldcontext = MemoryContextSwitchTo(context);
    for (int i = 0; i < 12; i++) {
        palloc(1024);
        show_context_stats(context);
    }
    MemoryContextSwitchTo(oldcontext);
}

}}}

以下が出力結果である。freelistは,ブロックの残りのチャンクスペースがリクエストサイズに満たない時に2の累乗の最大となるサイズから順に確保されている。(512, 256)

#geshi{{{
my context: 8192 total in 1 blocks; 7112 free (0 chunks); 1080 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (), 
INFO:  chunk[6] (), 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
my context: 8192 total in 1 blocks; 6064 free (0 chunks); 2128 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (), 
INFO:  chunk[6] (), 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
my context: 8192 total in 1 blocks; 5016 free (0 chunks); 3176 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (), 
INFO:  chunk[6] (), 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
my context: 8192 total in 1 blocks; 3968 free (0 chunks); 4224 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (), 
INFO:  chunk[6] (), 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
my context: 8192 total in 1 blocks; 2920 free (0 chunks); 5272 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (), 
INFO:  chunk[6] (), 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
my context: 8192 total in 1 blocks; 1872 free (0 chunks); 6320 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (), 
INFO:  chunk[6] (), 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
my context: 8192 total in 1 blocks; 824 free (0 chunks); 7368 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (), 
INFO:  chunk[6] (), 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
my context: 16384 total in 2 blocks; 7936 free (2 chunks); 8448 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (size = 256 byte, requested_size = 0 byte, 
INFO:  chunk[6] (size = 512 byte, requested_size = 0 byte, 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
my context: 16384 total in 2 blocks; 6888 free (2 chunks); 9496 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (size = 256 byte, requested_size = 0 byte, 
INFO:  chunk[6] (size = 512 byte, requested_size = 0 byte, 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
my context: 16384 total in 2 blocks; 5840 free (2 chunks); 10544 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (size = 256 byte, requested_size = 0 byte, 
INFO:  chunk[6] (size = 512 byte, requested_size = 0 byte, 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
my context: 16384 total in 2 blocks; 4792 free (2 chunks); 11592 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (size = 256 byte, requested_size = 0 byte, 
INFO:  chunk[6] (size = 512 byte, requested_size = 0 byte, 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
my context: 16384 total in 2 blocks; 3744 free (2 chunks); 12640 used
INFO:  ***** freelist *****
INFO:  chunk[0] (), 
INFO:  chunk[1] (), 
INFO:  chunk[2] (), 
INFO:  chunk[3] (), 
INFO:  chunk[4] (), 
INFO:  chunk[5] (size = 256 byte, requested_size = 0 byte, 
INFO:  chunk[6] (size = 512 byte, requested_size = 0 byte, 
INFO:  chunk[7] (), 
INFO:  chunk[8] (), 
INFO:  chunk[9] (), 
INFO:  chunk[10] (), 
}}}
* 参考・関連 [#vceb7bae]

- [[memutils.h>https://doxygen.postgresql.org/memutils_8h.html]] - on doxygen.postgresql.org
- [[aset.c>https://doxygen.postgresql.org/aset_8c.html]] - on doxygen.postgresql.org
- [[mcxt.c>https://doxygen.postgresql.org/mcxt_8c.html]] - on doxygen.postgresql.org
- [[palloc.h>PostgreSQL/開発/include/utils/palloc.h]]

&size(12){&color(white,orange){ 関連 };};

#related
* コメント [#m0e0ed05]

#comment



トップ   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
目次
ダブルクリックで閉じるTOP | 閉じる
GO TO TOP