vmmem

package
v0.8.13 Latest Latest
Warning

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

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

Documentation

Overview

Package vmmem reasons about the container runtime's memory ceiling. On macOS, Docker doesn't run containers natively — colima/Docker Desktop runs a Linux VM given a FIXED slice of host RAM, and that slice is the ceiling for ALL islands combined. A too-small VM (colima defaults to 2 GB) is the substrate-level cause of island OOMs (#23): no per-island knob helps when the whole pool is 2 GB on a 24 GB host. These helpers read host RAM, recommend a VM size, and judge whether the current VM is undersized — shared by the daemon (overview → TUI banner) and `dejima doctor` (the host-side check + colima fix).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColimaAvailable

func ColimaAvailable() bool

ColimaAvailable reports whether the colima CLI is on PATH (so the fix can be scripted). Docker Desktop has no CLI resize — its memory is a GUI slider.

func HostMemoryBytes

func HostMemoryBytes() uint64

HostMemoryBytes returns the host's physical RAM (cached — it doesn't change over a process's life). macOS: `sysctl hw.memsize`. Linux: MemTotal from /proc/meminfo. 0 when it can't be determined (callers treat 0 as "unknown", never as a problem).

func RecommendedBytes

func RecommendedBytes(host uint64) uint64

RecommendedBytes is the VM size to suggest for a host: three-quarters of host RAM, but always leaving the host at least 4 GiB so macOS itself isn't starved — min(¾·host, host−4 GiB) — rounded down to a whole GiB, floored at 2 GiB. 0 when host is unknown.

func RecommendedGB

func RecommendedGB(host uint64) int

RecommendedGB is RecommendedBytes in whole GiB (for the colima --memory flag).

func Undersized

func Undersized(host, vm uint64) bool

Undersized reports whether the VM is meaningfully smaller than recommended — the trigger for the doctor warning + TUI banner. Only fires when there's real headroom being wasted (VM below ¾ of the recommendation), so a VM that's merely a bit under ideal doesn't nag. False when either figure is unknown.

Types

This section is empty.

Jump to

Keyboard shortcuts

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