Skip to content

Commit

Permalink
mini-alloc: a very simple bump allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Benfield committed Nov 30, 2023
1 parent be5e5c8 commit 47c93f1
Show file tree
Hide file tree
Showing 9 changed files with 303 additions and 55 deletions.
151 changes: 151 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = ["stylus-sdk", "stylus-proc"]
members = ["stylus-sdk", "stylus-proc", "mini-alloc"]
resolver = "2"

[workspace.package]
Expand Down
60 changes: 9 additions & 51 deletions examples/erc20/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/erc20/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2021"
alloy-primitives = "0.3.1"
alloy-sol-types = "0.3.1"
stylus-sdk = { path = "../../../stylus-sdk-rs/stylus-sdk" }
wee_alloc = "0.4.5"
mini-alloc = { path = "../../../stylus-sdk-rs/mini-alloc" }

[features]
export-abi = ["stylus-sdk/export-abi"]
Expand All @@ -19,4 +19,4 @@ lto = true
panic = "abort"
opt-level = "s"

[workspace]
[workspace]
2 changes: 1 addition & 1 deletion examples/erc20/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use alloc::{string::String, vec::Vec};
use stylus_sdk::{alloy_primitives::U256, call, msg, prelude::*};

#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
static ALLOC: mini_alloc::MiniAlloc = mini_alloc::MiniAlloc::INIT;

mod erc20;

Expand Down
16 changes: 16 additions & 0 deletions mini-alloc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "mini-alloc"
keywords = ["wasm", "stylus", "allocator"]
description = "Very simple global allocator for WASM"
readme = "README.md"

authors.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
version.workspace = true

[dev-dependencies]
wasm-bindgen-test = "0.3.0"

[dependencies]
Loading

0 comments on commit 47c93f1

Please sign in to comment.