EmbeddingGemma 2: an open, lightweight multimodal embedding model
deepmind.google·6d ago

TL;DR
The _alloca function allocates memory on the stack by probing the stack space before adjusting the stack pointer. This ensures that large allocations do not bypass the guard page, preventing stack overflows.
✦ Why It Matters
Review your use of _alloca to ensure safe stack memory allocation in your applications.
Key Takeaways
How It Works
_alloca() allocates memory on the stack by first calling _chkstk() to probe the stack. This function checks if there is enough space for the requested allocation, ensuring that the guard page is not bypassed.
The assembly code illustrates the steps taken to create a local frame and allocate memory safely, demonstrating the importance of stack probing in preventing memory corruption.
Related