If I'm allocating memory with stackalloc
in C#, is that memory initialized (with 0
)?
The documentation doesn't speak of that and only tells that the correct amount is reserved.
In my tests such memory defaulted to 0
, but that doesn't mean it's guaranteed though.
From the spec:
18.8 Stack allocation
The content of the newly allocated memory is undefined.