我有一个用Go编写的服务器,它不会释放消耗的内存。我用GODEBUG=gctrace=1
选项启动了程序,得到以下输出:
scvg44: inuse: 1, idle: 423, sys: 425, released: 423, consumed: 1 (MB)
scvg45: inuse: 1, idle: 423, sys: 425, released: 423, consumed: 1 (MB)
...
scvg49: inuse: 1, idle: 423, sys: 425, released: 423, consumed: 1 (MB)
scvg50: inuse: 1, idle: 423, sys: 425, released: 423, consumed: 1 (MB)
因此,虽然输出显示向操作系统发布了423 MB,但似乎并非如此。该程序有几个小时的423 MB空闲内存。为什么程序不释放内存?