{"id":17953647,"url":"https://github.com/akutz/go-interface-values","last_synced_at":"2026-02-28T21:33:02.920Z","repository":{"id":44554957,"uuid":"452547461","full_name":"akutz/go-interface-values","owner":"akutz","description":"When storing a value in a Go interface allocates memory on the heap.","archived":false,"fork":false,"pushed_at":"2022-02-27T18:43:21.000Z","size":212,"stargazers_count":72,"open_issues_count":0,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-02T02:46:43.403Z","etag":null,"topics":["benchmark","go","golang","heap","malloc"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akutz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-27T05:09:41.000Z","updated_at":"2024-11-30T16:25:41.000Z","dependencies_parsed_at":"2022-09-15T16:51:36.277Z","dependency_job_id":null,"html_url":"https://github.com/akutz/go-interface-values","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/akutz/go-interface-values","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akutz%2Fgo-interface-values","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akutz%2Fgo-interface-values/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akutz%2Fgo-interface-values/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akutz%2Fgo-interface-values/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akutz","download_url":"https://codeload.github.com/akutz/go-interface-values/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akutz%2Fgo-interface-values/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29952286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T18:42:55.706Z","status":"ssl_error","status_checked_at":"2026-02-28T18:42:48.811Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["benchmark","go","golang","heap","malloc"],"created_at":"2024-10-29T10:06:28.385Z","updated_at":"2026-02-28T21:33:02.901Z","avatar_url":"https://github.com/akutz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go interface values\n\nThis repository deep dives Go interface values, what they are, how they work, and when storing a value in a Go interface allocates memory on the heap.\n\n* [**Labs**](#labs): a step-by-step walkthrough of the topic\n* [**FAQ**](#FAQ): answers to frequently asked questions\n* [**Links**](#links): links to related reference material\n* [**Thanks**](#thanks): it takes a community\n* [**Appendix**](#appendix): in-repo reference material\n\n\n## Labs\n\n1. [**Prerequisites**](./docs/01-prereqs/): how to get from here to there\n1. [**Interface values**](./docs/02-interface-values/): whatever you do, do not call it \"boxing\"\n1. [**Escape analysis**](./docs/03-escape-analysis/): to malloc or not to malloc\n1. [**Missing mallocs**](./docs/04-missing-mallocs/): there's a heap of missing memory\n1. [**Lessons learned**](./docs/05-lessons-learned/): key takeaways\n\n\n## FAQ\n\n* [**What does the `Q` suffix for instructions like `MOVQ` and `LEAQ` mean?**](#what-does-the-q-suffix-for-instructions-like-movq-and-leaq-mean)\n* [**What is the x86 assembly instruction `CALL` actually calling?**](#what-is-the-x86-assembly-instruction-call-actually-calling)\n* [**Where is the `CALL` instruction in ARM assembly?**](#where-is-the-call-instruction-in-arm-assembly)\n* [**What is the `hack` directory and the files inside of it?**](#what-is-the-hack-directory-and-the-files-inside-of-it)\n\n\n### What does the `Q` suffix for instructions like `MOVQ` and `LEAQ` mean?\n\nPlease refer to [this answer](./docs/99-appendix/assembly.md#what-does-the-q-suffix-for-instructions-like-movq-and-leaq-mean) from the assembly section in the appendix.\n\n\n### What is the x86 assembly instruction `CALL` actually calling?\n\nPlease refer to [this answer](./docs/99-appendix/assembly.md#what-is-the-x86-assembly-instruction-actually-calling) from the assembly section in the appendix.\n\n\n### Where is the `CALL` instruction in ARM assembly?\n\nPlease refer to [this answer](./docs/99-appendix/assembly.md#where-is-the-call-instruction-in-arm-assembly) from the assembly section in the appendix.\n\n\n### What is the [`hack`](./hack) directory and the files inside of it?\n\nThe `hack` directory is a convention I picked up from working on Kubernetes and projects related to Kuberentes. The directory contains scripts useful to the project, but not a core piece of the project itself. For example:\n\n* [**`hack/`**](./hack)\n  * [**`asm2md.py`**](./hack/asm2md.py): parses the output of `go tool compile -S -wb=false ./tests/mem/*.go` and produces a markdown table\n  * [**`b2md.py`**](./hack/b2md.py): parses the output of `go test -v -count 1 -benchtime 1000x -bench BenchmarkMem -run Mem -benchmem ./tests/mem` and produces a markdown table\n  * [**`gen.py`**](./hack/gen.py): generates [`./tests/mem/bench_test.go`](./tests/mem/mem_test.go) and [`./tests/mem/types_test.go`](./tests/mem/types_test.go)\n\n\n## Links\n\n* [**ARM developer documentation**](https://developer.arm.com/documentation/ddi0602/2021-12/?lang=en)\n* [**x86 and amd64 instruction set**](https://www.felixcloutier.com/x86/index.html)\n* [**A quick guide to Go assembly**](https://go.dev/doc/asm)\n* [**Go internal application binary interface (ABI) specification**](https://github.com/golang/go/blob/master/src/cmd/compile/abi-internal.md)\n* [**Logging, interfaces, and allocation**](https://commaok.xyz/post/interface-allocs/)\n* [**Go introduction to escape analysise**](https://medium.com/a-journey-with-go/go-introduction-to-the-escape-analysis-f7610174e890)\n* [**Type definitions for leaks**](https://github.com/golang/go/blob/master/src/cmd/compile/internal/escape/graph.go)\n* [**Enums for escape**](https://github.com/golang/go/blob/master/src/cmd/compile/internal/ir/node.go)\n* [**Type definition for a Go stack frame**](https://github.com/golang/go/blob/master/src/runtime/stack.go)\n\n\n## Thanks\n\n* Many thanks to reddit user _nikandfor_ for [their response](https://www.reddit.com/r/golang/comments/sdsfl9/trying_to_understand_when_boxing_results_in_a/huf2upt/) to my post on this topic. Without that initial work, I am not sure this repository would exist today.\n* My gratitude to Crypto Jones from Gopher Slack for keeping me honest about \"boxing.\" :smiley:\n* My colleague Michael Gasch who spent a lot of time proofreading this repository. Hear that y'all? Any mistakes you find? Totally Michael's fault! :smiley:\n* Andrew Williams, another co-worker, who did not judge me when he helpfully explained [cache lines](https://teivah.medium.com/go-and-cpu-caches-af5d32cc5592).\n* The first person who offered to help me dig into the assembly, Kevin Grittner!\n* Several of my colleagues who directed me to a [Trie](https://en.wikipedia.org/wiki/Trie) structure for the repository's bespoke test framework:\n  * Michal Jankowski\n  * Zhanghe Liu\n  * Yiyi Zhou\n  * Mayank Bhatt\n  * Arunesh Pandey\n\n\n## Appendix\n\n* [**Assembly**](./docs/99-appendix/assembly.md): reference section for go asm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakutz%2Fgo-interface-values","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakutz%2Fgo-interface-values","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakutz%2Fgo-interface-values/lists"}