Help us shape the future of Go! Take the 2026 Go Developer Survey

winmem

package
v0.84.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Rendered for windows/amd64

Overview

Package winmem provides memory usage metrics for Windows

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PageFileCallback

func PageFileCallback(
	handle C.GoHandle,
	pInfo C.PENUM_PAGE_FILE_INFORMATION,
	lpFilename C.LPCWSTR,
) C.BOOL

Types

type PageFilesContext

type PageFilesContext struct {
	PageFiles []*PagingFileStat
	PageSize  uint64
}

PageFilesContext is a context for the EnumPageFilesW function

type PagefileStat

type PagefileStat struct {
	// The current committed memory limit for the system or
	// the current process, whichever is smaller, in bytes
	Total uint64

	// The maximum amount of memory the current process can commit, in bytes.
	// This value is equal to or smaller than the system-wide available commit
	// value.
	Available uint64

	// Used is Total - Available
	Used uint64

	// UsedPercent is used as a percentage of the total pagefile
	UsedPercent float64
}

PagefileStat contains basic metrics for the windows pagefile

func PagefileMemory

func PagefileMemory() (*PagefileStat, error)

PagefileMemory returns paging (swap) file metrics

type PagingFileStat

type PagingFileStat struct {
	// The name of the paging file
	Name string

	// The total size of the paging file
	Total uint64

	// The amount of paging file that is available for use
	Available uint64

	// The amount of paging file that is used
	Used uint64

	// The percentage of paging file that is used
	UsedPercent float64
}

PagingFileStat contains statistics for paging files

func EnumPageFilesW

func EnumPageFilesW(pageSize uint64) ([]*PagingFileStat, error)

EnumPageFilesW enumerates page files

https://learn.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-enumpagefilesw

func PagingFileMemory

func PagingFileMemory() ([]*PagingFileStat, error)

PagingFileMemory returns paging file metrics

type SwapMemoryStat

type SwapMemoryStat struct {
	Total       uint64
	Used        uint64
	Free        uint64
	UsedPercent float64
}

SwapMemoryStat contains swap statistics

func SwapMemory

func SwapMemory() (*SwapMemoryStat, error)

SwapMemory returns swapfile statistics

type VirtualMemoryStat

type VirtualMemoryStat struct {
	// Total amount of RAM on this system
	Total uint64

	// RAM available for programs to allocate
	//
	// This value is computed from the kernel specific values.
	Available uint64

	// RAM used by programs
	//
	// This value is computed from the kernel specific values.
	Used uint64

	// Percentage of RAM used by programs
	//
	// This value is computed from the kernel specific values.
	UsedPercent float64
}

VirtualMemoryStat contains basic metrics for virtual memory

func VirtualMemory

func VirtualMemory() (*VirtualMemoryStat, error)

VirtualMemory returns virtual memory metrics for the machine

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL