liveBook · Manning

MemInfo

As explained in Build and Orchestrator in Go (From Scratch)

MemInfo is a goprocinfo type representing memory information read from the Linux proc filesystem.

MemInfo is a goprocinfo type that reads memory data from Linux’s /proc filesystem through ReadMemInfo. It provides the raw memory state used by worker metrics. section 6.3

A Stats wrapper stores MemInfo as its MemStats pointer alongside disk, CPU, and load types. Helper methods expose total, available, used, and percentage-oriented memory metrics without repeating field access. section 6.3

Reading memory metrics

GetMemoryInfo calls linux.ReadMemInfo("/proc/meminfo"). On failure it logs an error and returns an empty MemInfo, allowing GetStats to construct a complete Stats value.

How Build and Orchestrator in Go (From Scratch) covers it

How deep it goes
Explains acquisition, wrapper composition, accessors, and error fallback, but does not detail /proc/meminfo parsing internals.
Examples
Uses GetMemoryInfo, /proc/meminfo, Stats.MemStats, and memory accessor methods as implementation examples.
What it assumes
Assumes basic Go structs and pointers, while introducing proc-based metric collection through concrete helper functions.
What you can do after
Operate/configure goprocinfo to collect memory metrics through a unified Stats wrapper.
How it connects
Connects Linux proc filesystem, /proc/meminfo, goprocinfo, Stats, and worker monitoring.

This explainer was generated by Manning's knowledge graph from the text of Build and Orchestrator in Go (From Scratch). The section links point to the parts of the book it draws on.