-
-
Notifications
You must be signed in to change notification settings - Fork 670
Static memory segment idea #1232
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
Comments
How about |
Yes! This would help reduce globals and enable creating threaded memory allocators. My vote is on memory.init(). |
|
alright, May be |
An alternative might be |
|
For the record, I liked |
This is a very useful addition! |
So we have
StaticArray
now, which is great on its own but still a managed object, and it would be even greater if there'd also be a way to get some raw static memory. Proposing the following:Extend the
memory
namespace to be also a function, that one can use likeyielding a static pointer to 64 bytes of reserved static memory. When using this in a function
the segment will always be exactly the same, so calling the function above multiple times would yield 0, 1, 2, 3, ... quite similar to what
static
in C does. This can then be used for various things, like as an alternative to (temporary) stack allocation as long as one makes sure that it is not being accessed in parallel. The argument must be a compile-time constant.Thoughts?
The text was updated successfully, but these errors were encountered: