Concordium / concordium-rust-smart-contracts

Libraries and tools for writing and testing smart contracts on Concordium
https://docs.rs/concordium-std/latest/concordium_std/
Mozilla Public License 2.0
57 stars 35 forks source link

Add a "bump allocator", a small and simple allocator for Wasm #392

Closed Bargsteen closed 8 months ago

Bargsteen commented 8 months ago

Purpose

This PR implements a new allocator for our smart contracts. It is simple and has a small code size. It uses more memory than a linked-list allocator such as wee_alloc, but for many contracts, this simplicity is sufficient and better.

Something I discovered while building this, is that the Rust compiler sets the initial number of pages in wasm modules to 17, which seems like quite a lot for smart contracts. Each page is 64KiB, so the initial memory is always ~1.1 MiB.

Closes https://github.com/Concordium/concordium-rust-smart-contracts/issues/379

TODO

Changes

Checklist

abizjak commented 8 months ago

@Bargsteen I suppose this is just waiting for us to release concordium-std/testing library before it can be merged?

Bargsteen commented 8 months ago

@Bargsteen I suppose this is just waiting for us to release concordium-std/testing library before it can be merged?

Yep :-)