C#

C#

Made by DeepSource

Potential memory leak inside for loop due to stackalloc CS-W1025

Bug risk
Critical

A 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.

Reference