-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.NET - Potentially large memory allocation at each call #18
Comments
I'm also wondering what the reason is for not using a simple |
Due to compiler optimizations none of the arrays are allocated or even exist, the spans refer directly to static data |
Oh, I missed that news about compiler optimization, it's really confusing in its non-obviousness. Thanks for the useful information |
In the code there is such a thing:
Probably the expectation here was that the array would be created once. But in fact it will be created every time the property is accessed, because the expression-bodied property is just syntactic sugar for
get { return new ... }
To avoid potential memory problems you should replace this with:
The text was updated successfully, but these errors were encountered: