for
loop due to stackalloc
CS-W1025A stackalloc
expression allocates a block of memory on the stack and is cleaned up only when the controller exits the method. Placing a stackalloc
expression inside a loop continuously allocates memory and does not let it get discarded despite the controller exiting the loop's scope. It is therefore recommended that you rethink your approach.