# Allocating on the Stack

DevFeed: [Allocating on the Stack](<https://devfeed.tech/articles/allocating-on-the-stack-2355.md>)

Original publisher: [Read original article](<https://go.dev/blog/allocation-optimizations>)

Author: Keith Randall

Published: 2026-02-27T00:00:00Z

Content type: article

Language: en

Sources: [The Go Blog](<https://devfeed.tech/sources/the-go-blog.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Code](<https://devfeed.tech/topics/code.md>), [Caching](<https://devfeed.tech/topics/caching.md>)

Tags: [cache](<https://devfeed.tech/tags/cache.md>), [code](<https://devfeed.tech/tags/code.md>), [go](<https://devfeed.tech/tags/go.md>), [memory](<https://devfeed.tech/tags/memory.md>)

## AI overview

This article describes recent Go compiler and runtime optimization work that moves suitable allocations from the heap to the stack. It explains how stack allocation can reduce allocator overhead, garbage-collector load, and the startup cost of repeatedly growing slices.

## Source excerpt

A description of some of the recent changes to do allocations on the stack instead of the heap.