Win32 API 日本語リファレンス
ホームSystem.Memory › HEAP_SUMMARY

HEAP_SUMMARY

構造体
サイズx64: 40 バイト / x86: 20 バイト

サイズ=各フィールドのバイト数(x64/x86 で異なる場合は x64/x86 と併記)。x64/x86 列=フィールドのバイトオフセット(HSPで dupptr / lpoke / wpoke 等に使用)。

フィールド

フィールドサイズx64x86説明
cbDWORD4+0+0このデータ構造のサイズ (バイト単位)。このメンバーには sizeof(HEAP_SUMMARY) を設定します。
cbAllocatedUINT_PTR8/4+8+4割り当て済みメモリのサイズ。
cbCommittedUINT_PTR8/4+16+8コミット済みメモリのサイズ。
cbReservedUINT_PTR8/4+24+12予約済みメモリのサイズ。
cbMaxReserveUINT_PTR8/4+32+16予約可能な最大メモリのサイズ。

公式ドキュメント

HeapSummary の呼び出しによって取得されるヒープの概要を表します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での定義

#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 Structure
import 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: uint
struct 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