COSCUP x RubyConf TW 2021

Go memory allocation and deallocation

演講摘要

In the modern programming language, the memory usually separated into stack and heap. The heap size changes during runtime. I want to introduce the mechanism and strategy Go used to allocate new memory and deallocate the memory. Start from tcallocator component, mcache, mcentral, and mheap and how they interact with each other when the allocation happened. The garbage collector is responsible for deallocation. How to reuse the memory in the heap? When should we release the memory to OS?

英文演講摘要

In the modern programming language, the memory usually separated into stack and heap. The heap size changes during runtime. I want to introduce the mechanism and strategy Go used to allocate new memory and deallocate the memory. Start from tcallocator component, mcache, mcentral, and mheap and how they interact with each other when the allocation happened. The garbage collector is responsible for deallocation. How to reuse the memory in the heap? When should we release the memory to OS?

Gaston Chiu