Runtime Go 1.12 significantly improves the performance of sweeping when a large fraction of the heap remains live. This reduces allocation latency immediately following a garbage collection.
(中间省略 2 段不太相关的内容) On Linux, the runtime now uses MADV_FREE to release unused memory. This is more efficient but may result in higher reported RSS. The kernel will reclaim the unused data when it is needed.
1 |
|
1 | 3261164 xxx 20 0 52.375g 0.035t 36524 S 579.1 66.0 16711:10 [打码] |
- Go 1.12 升级能降低内存分配的延迟,但会导致进程 RSS 变高
- 因为 Go 1.12 用 MADV_FREE,会让内核延迟回收内存
- 通过在页表中做标记的方式,延迟内存的分配和回收,可以提高内存管理的效率
- 可以通过气球来让 OS/Hypervisor 挤占内存,另作他用