GoFree: Reducing garbage collection via compiler-inserted freeing

Download: PDF, artifact.

“GoFree: Reducing garbage collection via compiler-inserted freeing” by Haoran Peng, Yu Zhang, Michael D. Ernst, Jinbao Chen, and Boyao Ding. In CGO 2025: International Symposium on Code Generation and Optimization, (Las Vegas, NV, USA), Mar. 2025, pp. 675-688.

Abstract

In a memory-managed programming language, programmers allocate memory by creating new objects, but programmers never free memory. A garbage collector (GC) periodically reclaims memory used by unreachable objects. As an optimization based on escape analysis, some memory can be freed explicitly by instructions inserted by the compiler. This optimization reduces the cost of garbage collection, without changing the programming model.

We designed and implemented this explicit freeing optimization for the Go language. We devised a new escape analysis that is both powerful and fast (O(N^2) time). Our escape analysis identifies short-lived heap objects that can be safely explicitly deallocated. We also implemented a freeing primitive that is safe for use in concurrent environments.

We evaluated our system, GoFree, on 6 open-source Go programs. GoFree did not observably slow down compilation. At run time, GoFree deallocated on average 14% of allocated heap memory. It reduced GC frequency by 7%, GC time by 13%, wall-clock time by 2%, and heap size by 4%. We made GoFree open-source.

Download: PDF, artifact.

BibTeX entry:

@inproceedings{PengZECD2025,
   author = {Haoran Peng and Yu Zhang and Michael D. Ernst and Jinbao Chen
	and Boyao Ding},
   title = {GoFree: Reducing garbage collection via compiler-inserted freeing},
   booktitle = {CGO 2025: International Symposium on Code Generation and
	Optimization},
   pages = {675-688},
   address = {Las Vegas, NV, USA},
   month = mar,
   year = {2025}
}

(This webpage was created with bibtex2web.)

Back to Michael Ernst's publications.