Skip to content

Commit

Permalink
Use default allocator instead of wee_alloc in numbat-wasm
Browse files Browse the repository at this point in the history
Crate has major unresolved issues such as memory leaks
(rustwasm/wee_alloc#106). wee_alloc's last
commit at the moment was made shy of 3 years ago, and the latest release
is over 4 years old.
  • Loading branch information
triallax committed Jan 22, 2024
1 parent 4efd0ea commit 884e2a1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 42 deletions.
35 changes: 5 additions & 30 deletions numbat-wasm/Cargo.lock

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

5 changes: 0 additions & 5 deletions numbat-wasm/Cargo.toml
Expand Up @@ -19,11 +19,6 @@ wasm-bindgen = "0.2.63"
# code size when deploying.
console_error_panic_hook = { version = "0.1.6", optional = true }

# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
# allocator, however.
wee_alloc = { version = "0.4.5", optional = true }

numbat = { path = "../numbat", default-features = false }
html-escape = "0.2.13"
termcolor = "1.3.0"
Expand Down
2 changes: 1 addition & 1 deletion numbat-wasm/build.sh
Expand Up @@ -3,4 +3,4 @@
set -euo pipefail

rm -rf www/pkg
wasm-pack build --features=wee_alloc --target=web --out-dir=www/pkg
wasm-pack build --target=web --out-dir=www/pkg
6 changes: 0 additions & 6 deletions numbat-wasm/src/lib.rs
Expand Up @@ -19,12 +19,6 @@ use numbat::resolver::CodeSource;
use numbat::{markup as m, NameResolutionError, NumbatError};
use numbat::{Context, InterpreterSettings};

// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[wasm_bindgen]
pub fn setup_panic_hook() {
utils::set_panic_hook();
Expand Down

0 comments on commit 884e2a1

Please sign in to comment.