英文:
golang - Meaning of green area of heap in trace
问题
- 在下面的图像中,绿色区域是否未被使用,并且是Go应用程序独占的内存区域?
- 为什么Go会将内存保留在绿色区域而不立即释放?
- 那个区域是否也计入内存使用量中?
英文:
- In the image below, is the green area not being used and is the memory area that the Go application only has?
- Why do Go keep the memory in the green area without freeing it right away?
- Is that area also included in the memory usage?
答案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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论