dongyou6768 2016-05-20 17:41
浏览 627

Go的runtime.ReadMemStats报告的统计信息是否应该大约等于ps aux报告的常驻内存集?

In Go Should the "Sys" stat or any other stat/combination reported by runtime.ReadMemStats approximately equal the resident memory set reported by ps aux?

Alternatively, assuming some memory may be swapped out, should the Sys stat be approximately greater than or equal to the RSS?

We have a long-running web service that deals with a high frequency of requests and we are finding that the RSS quickly climbs up to consume virtually all of the 64GB memory on our servers. When it hits ~85% we begin to experience considerable degradation in our response times and in how many concurrent requests we can handle. The run I've listed below is after about 20 hours of execution, and is already at 51% memory usage.

I'm trying to determine if the likely cause is a memory leak (we make some calls to CGO). The data seems to indicate that it is, but before I go down that rabbit hole I want to rule out a fundamental misunderstanding of the statistics I'm using to make that call.

This is an amd64 build targeting linux and executing on CentOS.

Reported by runtime.ReadMemStats:

Alloc:     1294777080 bytes (1234.80MB)  // bytes allocated and not yet freed
Sys:       3686471104 bytes (3515.69MB)  // bytes obtained from system (sum of XxxSys below)
HeapAlloc: 1294777080 bytes (1234.80MB)  // bytes allocated and not yet freed (same as Alloc above)
HeapSys:   3104931840 bytes (2961.09MB)  // bytes obtained from system
HeapIdle:  1672339456 bytes (1594.87MB)  // bytes in idle spans
HeapInuse: 1432592384 bytes (1366.23MB)  // bytes in non-idle span

Reported by ps aux:

%CPU %MEM       VSZ      RSS 
1362 51.3 306936436 33742120
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
    • ¥15 相敏解调 matlab
    • ¥15 求lingo代码和思路
    • ¥15 公交车和无人机协同运输
    • ¥15 stm32代码移植没反应
    • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
    • ¥100 连续两帧图像高速减法
    • ¥15 如何绘制动力学系统的相图
    • ¥15 对接wps接口实现获取元数据
    • ¥20 给自己本科IT专业毕业的妹m找个实习工作