doule0941 2019-04-22 06:44
浏览 617

golang程序内存不断增长,但只有一点inuse_space

I have a golang program running some routines periodically. Its memory (RSS in top result) keep growing on some servers but on some server it doesn’t. What's weird is that the pprof result of the RSS-growing instance shows the process is taking just little inuse_space memory.

Does this mean that the memory is waiting for golang to GC? But After 48 hours, memory growing from 26000kb to 74000kb, I think golang should have already do GC several times itself.

I have already use sync.Pool to avoid frequently new()ing objects. How I could reduce memory usage?

The detailed data is attached below, Thanks in advance!

RSS usage in 48 hours(in kb): enter image description here

inuse_space:

(pprof) top
Showing nodes accounting for 1040.73kB, 100% of 1040.73kB total
      flat  flat%   sum%        cum   cum%
  524.09kB 50.36% 50.36%   524.09kB 50.36%  sp/audit.Coll
  516.64kB 49.64%   100%   516.64kB 49.64%  sp/audit.Coll.func2
         0     0%   100%   524.09kB 50.36%  sa/core.(*pr).run
         0     0%   100%   516.64kB 49.64%  sa/fw.(*Group).Go.func1
         0     0%   100%   516.64kB 49.64%  sp/audit/dis.(*Relay).Relay
         0     0%   100%   516.64kB 49.64%  sync.(*Pool).Get
(pprof) top -cum
Showing nodes accounting for 1040.73kB, 100% of 1040.73kB total
      flat  flat%   sum%        cum   cum%
         0     0%     0%   524.09kB 50.36%  sa/core.(*pr).run
  524.09kB 50.36% 50.36%   524.09kB 50.36%  sp/audit.Coll
         0     0% 50.36%   516.64kB 49.64%  sa/fw.(*Group).Go.func1
  516.64kB 49.64%   100%   516.64kB 49.64%  sp/audit.Coll.func2
         0     0%   100%   516.64kB 49.64%  sp/audit/dis.(*Relay).Relay
         0     0%   100%   516.64kB 49.64%  sync.(*Pool).Get

alloc_space:

Showing top 10 nodes out of 181
      flat  flat%   sum%        cum   cum%
 3306.19MB 25.83% 25.83%  3306.71MB 25.84%  io.copyBuffer
 1294.76MB 10.12% 35.95%  1386.15MB 10.83%  os.(*File).readdirnames
 1121.62MB  8.76% 44.71%  1121.62MB  8.76%  syscall.anyToSockaddr
  471.56MB  3.68% 48.40%   471.56MB  3.68%  net.newFD
  413.74MB  3.23% 51.63%   413.74MB  3.23%  bytes.makeSlice
  356.52MB  2.79% 54.41%   356.52MB  2.79%  github.com/go-xorm/xorm.(*Statement).Init
  261.55MB  2.04% 56.46%   309.05MB  2.41%  os.lstatNolog
  241.03MB  1.88% 58.34%   275.03MB  2.15%  os.Readlink
  236.51MB  1.85% 60.19%   236.51MB  1.85%  reflect.packEface
  230.51MB  1.80% 61.99%   230.51MB  1.80%  net.sockaddrToUnix
(pprof) top -cum
Showing nodes accounting for 3328.69MB, 26.01% of 12798.76MB total
Dropped 439 nodes (cum <= 63.99MB)
Showing top 10 nodes out of 181
      flat  flat%   sum%        cum   cum%
    6.50MB 0.051% 0.051%  6244.66MB 48.79%  sp/filesystem.walk
         0     0% 0.051%  6244.66MB 48.79%  sp/filesystem.walkProxy
         0     0% 0.051%  6088.14MB 47.57%  sa/fw.(*WorkerPool).StartWorker.func1
         0     0% 0.051%  5073.21MB 39.64%  sa/core.(*procRuntime).run
       1MB 0.0078% 0.059%  3446.69MB 26.93%  sp/filesystem.buildFileStat
       4MB 0.031%  0.09%  3431.67MB 26.81%  sp/filesystem.Chksum
         0     0%  0.09%  3334.15MB 26.05%  io.CopyN
         0     0%  0.09%  3306.71MB 25.84%  io.Copy
 3306.19MB 25.83% 25.92%  3306.71MB 25.84%  io.copyBuffer
      11MB 0.086% 26.01%  2659.24MB 20.78%  sa/fw.(*DBO).insertKeepOld
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料