# How \`alloca\` Allocates Stack Memory Without Skipping the Guard Page

Original title: How do functions like alloca allocate memory from the stack?

> Hacker News story 49478525 · language: en · submitted 2026-08-28
> Web version: https://zeli.app/story/49478525
> About this feed: https://zeli.app/llms.txt · Agent guide: https://zeli.app/skill.md

▲ 12 · by [ibobev](<https://news.ycombinator.com/user?id=ibobev>) · 💬 1
[original](<https://devblogs.microsoft.com/oldnewthing/20260817-00/?p=112617>) · [HN discussion](<https://news.ycombinator.com/item?id=49478525>)

## Summary

Raymond Chen explains how `_alloca` and similar functions allocate memory from the stack while ensuring the guard page is properly probed. Using a concrete x86-64 example, he shows that `_alloca` calls the same `__chkstk` function used for local frame setup, which probes the stack in pages to avoid skipping over the guard page. This prevents potential stack overflow issues.

## Key quote

> Observe that the same `__chkstk` function is used both for performing the initial stack probe when creating the local frame as well as for the `alloca()`.

---

## Cite

- Page: https://zeli.app/story/49478525
- Date: 2026-08-28
- Source: devblogs.microsoft.com (https://devblogs.microsoft.com/oldnewthing/20260817-00/?p=112617)
- Hacker News: https://news.ycombinator.com/item?id=49478525

## Other languages

- zh: https://zeli.app/zh/story/49478525 · markdown: https://zeli.app/zh/story/49478525.md
- ja: https://zeli.app/ja/story/49478525 · markdown: https://zeli.app/ja/story/49478525.md
- ko: https://zeli.app/ko/story/49478525 · markdown: https://zeli.app/ko/story/49478525.md
- de: https://zeli.app/de/story/49478525 · markdown: https://zeli.app/de/story/49478525.md
- es: https://zeli.app/es/story/49478525 · markdown: https://zeli.app/es/story/49478525.md
- ru: https://zeli.app/ru/story/49478525 · markdown: https://zeli.app/ru/story/49478525.md
