-
Notifications
You must be signed in to change notification settings - Fork 43
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
(#478) allocate once and reuse memory for env vars #524
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this is great! One minor issue though.
Cesium.Runtime/StdLibFunctions.cs
Outdated
{ | ||
return null; | ||
} | ||
|
||
return StdIoFunctions.MarshalStr(Environment.GetEnvironmentVariable(str)); | ||
_envVarsStorage ??= InitEnvVarsStorage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little concerned about the thread safety here. If two threads enter this field, then _envVarsStorage
will just silently leak.
Let's just make it Lazy
? What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Fixed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Closes #478