Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC#stackalloc and the stackSingle-choice MCQ

Why is calling stackalloc inside a loop a classic stack-overflow bug, even when each individual buffer is small?

for (int i = 0; i < count; i++) { Span<byte> buf = stackalloc byte[256]; Process(buf); }