Skip to content
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

Consider lazily allocating runtime Wasm memory in the Wasm node #1785

Open
tomaka opened this issue Dec 14, 2021 · 0 comments
Open

Consider lazily allocating runtime Wasm memory in the Wasm node #1785

tomaka opened this issue Dec 14, 2021 · 0 comments

Comments

@tomaka
Copy link
Contributor

tomaka commented Dec 14, 2021

Right now when compiling the runtime, we immediately allocate all the memory that will be needed (including the heap).

This is the most optimal solution in terms of speed, but in the case of the Wasm node it might be preferable to only allocate memory right before performing a call, and free that memory at the end of the call.

In the Wasm node, this memory is by very far the highest consumption. Each chain uses around 230 MiB of memory, out of which 128 MiB consists in the heap. Note that the figure of 230 MiB is too large because heap pages are currently not properly implemented, but it is sure that 128 MiB is the heap, because that's part of the design of Substrate/Polkadot.

This would decrease the memory usage of each chain, and therefore allow more chains to be started on any given smoldot instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant