observer.Serve makes its 1024-row onUsage queue when the gateway starts,
for every user, with or without a module that has onUsage. Its slots were
whole usage.Records (~930 bytes each), so the empty queue held ~1 MB for
the life of the process: 1.08 MB of the 18.9 MB idle heap with real
accounts at 1c3056a2e. A slot is now a pointer (8 KB for the queue); a row
is copied only when a module has onUsage, as before (Ledger returns first
otherwise).
Run on mote at this head: go test ./internal/middleware ok; gofmt clean;
GOOS=windows go vet and GOOS=linux go vet -tags nogui
./internal/middleware ok.
Broken by hand: with the old points.go, TestOnUsageQueueIsSmall fails
("the queue's slots take 950272 bytes, want at most 16 KB").
Siblings: no other buffered channel of a value type is larger than 16
slots (grep make(chan in internal).