{
  "id": 7809490,
  "title": "A Million Go Map Entries Take 38MB, Not 16MB",
  "url": "https://urgent.news/2026/09/16/a-million-go-map-entries-take-38mb-not-16mb",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-16T14:47:35.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/nazar-boyko/a-million-go-map-entries-take-38mb-not-16mb-2ij3"
  },
  "original_language": "en",
  "account": "A recent investigation discovered that a commonly cited figure of 16 bytes per entry for Go maps is inaccurate. While each entry does consume 8 bytes for the key and 8 bytes for the value, the actual memory usage is higher due to additional overhead. This new map implementation, introduced in Go 1.24, eliminates buckets and uses a different structure called Swiss Tables. An entry in this new map costs 192 bytes of heap memory. As the number of entries grows, the cost per entry fluctuates between 21 and 44 bytes. This discrepancy arises because the map uses groups of 8 slots plus an 8-byte control word, with each full slot containing the low 7 bits of the key's hash. Consequently, a map containing one million entries takes up approximately 37.8MB of memory, which is significantly more than the previously estimated 16MB.",
  "summary": "A few months ago, I noticed an issue with the internal structure of the new Go map—specifically regarding empty slots! So I decided to figure out why a map[int64]int64 theoretically appears to be 16 bytes per element: 8 bytes for the key + 8 bytes for the value. But in Go 1.27.1, 1,000,000 elements take up approximately 37.8 MB, which is ~37.8 bytes per element. This made me wonder: where do…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}