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

What happens at runtime if a stackalloc is executed inside a loop without the result escaping to a Span, as below?

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