golang – “green area”在跟踪中的含义是什么?

huangapple go评论84阅读模式
英文:

golang - Meaning of green area of ​heap in trace

问题

  1. 在下面的图像中,绿色区域是否未被使用,并且是Go应用程序独占的内存区域?
  2. 为什么Go会将内存保留在绿色区域而不立即释放?
  3. 那个区域是否也计入内存使用量中?

golang – “green area”在跟踪中的含义是什么?

英文:
  1. In the image below, is the green area not being used and is the memory area that the Go application only has?
  2. Why do Go keep the memory in the green area without freeing it right away?
  3. Is that area also included in the memory usage?

golang – “green area”在跟踪中的含义是什么?

答案1

得分: 2

堆显示了程序执行过程中的内存分配情况。红色区域表示程序使用的内存(堆),绿色区域表示垃圾回收器(GC)释放的内存。绿色区域下面的红色区域表示GC执行后正在使用的堆。如果你放大堆使用减少的区域,你可以看到GC释放了多少内存。当然,绿色区域可以被程序重新使用(并且根据分配给程序的RAM可以更多地使用)。

谢谢。

英文:

Heap shows memory allocations during the execution of your program. The red area is the memory(heap) used by your program. And the green area is the memory freed by the garbage collector(GC). The red area under the green area is the heap being used after the GC execution. If you zoom the area where heap usage is reduced, you can see how much memory the GC was able to release. And of course, the green area can be reused by your program(and can be more based on the RAM allocated to your program)

Thanks

huangapple
  • 本文由 发表于 2022年3月8日 09:48:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/71389144.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定