Refactor memory checker to use go-postgres/memcheck #6
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The
go-postgreslibrary now has a reusablememcheckpackage that provides:memcheck.Stats— snapshot of Alloc, TotalAlloc, Sys, HeapObjects, NumGC, Goroutinesmemcheck.ReadStats()— wrapsruntime.ReadMemStatsmemcheck.FormatBytes()— human-readable byte formattingmemcheck.Monitor— configurable memory limit with thread-safe exceeded flagjs && wasm) that callsdebug.SetMemoryLimit(900MB)in init()See: https://codeberg.org/hum3/go-postgres/issues/6
What to change
demo_state.go:checkMemory— Replace withmemcheck.Monitor.Check()capSlicehelper — May no longer be needed if memory monitoring is centralisedmain_wasm.go:debug.SetMemoryLimit— Remove; thememcheckpackage init() handles this automatically when importedgithub.com/drummonds/go-postgres/memcheckinstead of directruntimecallsBenefits
Migrated from Codeberg: originally #6, opened 2026-03-20.