golang – Meaning of green area of ​heap in trace

Issue

  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?

enter image description here

Solution

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

Answered By – Pratheesh M

Answer Checked By – Pedro (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.