ホーム › System.Memory › HEAP_SUMMARY
HEAP_SUMMARY
構造体サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。
フィールド
| フィールド | 型 | サイズ | x64 | x86 | 説明 |
|---|---|---|---|---|---|
| cb | DWORD | 4 | +0 | +0 | この構造体のバイト単位サイズ。呼び出し前に設定する。 |
| cbAllocated | UINT_PTR | 8/4 | +8 | +4 | 現在割り当て済みのバイト数。 |
| cbCommitted | UINT_PTR | 8/4 | +16 | +8 | ヒープにコミットされたバイト数。 |
| cbReserved | UINT_PTR | 8/4 | +24 | +12 | ヒープに予約されたバイト数。 |
| cbMaxReserve | UINT_PTR | 8/4 | +32 | +16 | ヒープが予約できる最大バイト数。 |
各言語での定義
#include <windows.h>
// HEAP_SUMMARY (x64 40 / x86 20 バイト)
typedef struct HEAP_SUMMARY {
DWORD cb;
UINT_PTR cbAllocated;
UINT_PTR cbCommitted;
UINT_PTR cbReserved;
UINT_PTR cbMaxReserve;
} HEAP_SUMMARY;using System;
using System.Runtime.InteropServices;
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct HEAP_SUMMARY
{
public uint cb;
public UIntPtr cbAllocated;
public UIntPtr cbCommitted;
public UIntPtr cbReserved;
public UIntPtr cbMaxReserve;
}Imports System.Runtime.InteropServices
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)>
Public Structure HEAP_SUMMARY
Public cb As UInteger
Public cbAllocated As UIntPtr
Public cbCommitted As UIntPtr
Public cbReserved As UIntPtr
Public cbMaxReserve As UIntPtr
End Structureimport ctypes
from ctypes import wintypes
class HEAP_SUMMARY(ctypes.Structure):
_fields_ = [
("cb", wintypes.DWORD),
("cbAllocated", ctypes.c_size_t),
("cbCommitted", ctypes.c_size_t),
("cbReserved", ctypes.c_size_t),
("cbMaxReserve", ctypes.c_size_t),
]#[repr(C)]
pub struct HEAP_SUMMARY {
pub cb: u32,
pub cbAllocated: usize,
pub cbCommitted: usize,
pub cbReserved: usize,
pub cbMaxReserve: usize,
}import "golang.org/x/sys/windows"
type HEAP_SUMMARY struct {
cb uint32
cbAllocated uintptr
cbCommitted uintptr
cbReserved uintptr
cbMaxReserve uintptr
}type
HEAP_SUMMARY = record
cb: DWORD;
cbAllocated: NativeUInt;
cbCommitted: NativeUInt;
cbReserved: NativeUInt;
cbMaxReserve: NativeUInt;
end;const HEAP_SUMMARY = extern struct {
cb: u32,
cbAllocated: usize,
cbCommitted: usize,
cbReserved: usize,
cbMaxReserve: usize,
};type
HEAP_SUMMARY {.bycopy.} = object
cb: uint32
cbAllocated: uint
cbCommitted: uint
cbReserved: uint
cbMaxReserve: uintstruct HEAP_SUMMARY
{
uint cb;
size_t cbAllocated;
size_t cbCommitted;
size_t cbReserved;
size_t cbMaxReserve;
}HSP用 定義
HSP3.7/3.8 は構造体機能が無いため4byte整数配列(dim)+peek/poke で操作(32/64bitでサイズ・位置が異なる場合はタブで分割)。IronHSP は NSTRUCT(#defstruct/stdim/->)で32/64bit共通。
; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x86 レイアウト)
; HEAP_SUMMARY サイズ: 20 バイト(x86)
dim st, 5 ; 4byte整数×5(構造体サイズ 20 / 4 切り上げ)
; cb : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; cbAllocated : UINT_PTR (+4, 4byte) st.1 = 値 / 値 = st.1 (lpoke/lpeek も可)
; cbCommitted : UINT_PTR (+8, 4byte) st.2 = 値 / 値 = st.2 (lpoke/lpeek も可)
; cbReserved : UINT_PTR (+12, 4byte) st.3 = 値 / 値 = st.3 (lpoke/lpeek も可)
; cbMaxReserve : UINT_PTR (+16, 4byte) st.4 = 値 / 値 = st.4 (lpoke/lpeek も可)
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; HSP3.7/3.8 は構造体機能が無いため、4byte整数の配列変数で操作します。(x64 レイアウト)
; HEAP_SUMMARY サイズ: 40 バイト(x64)
dim st, 10 ; 4byte整数×10(構造体サイズ 40 / 4 切り上げ)
; cb : DWORD (+0, 4byte) st.0 = 値 / 値 = st.0 (lpoke/lpeek も可)
; cbAllocated : UINT_PTR (+8, 8byte) qpoke st,8,値 / qpeek(st,8) ※IronHSPのみ。3.7/3.8は lpoke st,8,下位 : lpoke st,12,上位
; cbCommitted : UINT_PTR (+16, 8byte) qpoke st,16,値 / qpeek(st,16) ※IronHSPのみ。3.7/3.8は lpoke st,16,下位 : lpoke st,20,上位
; cbReserved : UINT_PTR (+24, 8byte) qpoke st,24,値 / qpeek(st,24) ※IronHSPのみ。3.7/3.8は lpoke st,24,下位 : lpoke st,28,上位
; cbMaxReserve : UINT_PTR (+32, 8byte) qpoke st,32,値 / qpeek(st,32) ※IronHSPのみ。3.7/3.8は lpoke st,32,下位 : lpoke st,36,上位
; ※4byte境界の整数は添字 st.N(N=オフセット/4)で読み書き可。それ以外は peek/poke 系を使用。; IronHSP は NSTRUCT(構造体)をサポート。32bit/64bit どちらでも同じコードで動作します。
#defstruct global HEAP_SUMMARY
#field int cb
#field intptr cbAllocated
#field intptr cbCommitted
#field intptr cbReserved
#field intptr cbMaxReserve
#endstruct
stdim st, HEAP_SUMMARY ; NSTRUCT 変数を確保
st->cb = 100
mes "cb=" + st->cb