I push a bunch of requests through the web server, and according to Htop / activity monitor on my mac, Virt is 530G, Res is 247Mb.
The memory doesn't seem to be being released to the OS. I tried adding the following for force memory to be returned to OS as a test to no avail:
func freeMem() {
tick := time.Tick(time.Second * 10)
for range tick {
debug.FreeOSMemory()
}
}
and at the top of main, calling go freeMem()
, but this seems to have no effect.
So I tried checking garbage collector is working properly and visualising with dave cheney's gcvis https://github.com/davecheney/gcvis:
Looks like gcvis shows things are working fine and dandy, but htop & activity monitor seem to be v high memory usage.
Do I have anything to worry about? One thing I did notice in gcvis, is that whilst gc.heapinuse
goes down to acceptable levels, scvg.released
and scvg.sys
seem to remain high.