# Practical guides on no\_std and wasm support

**URL:** <https://users.rust-lang.org/t/practical-guides-on-no-std-and-wasm-support/94762>\
**Category:** tutorials\
**Created:** [June 2, 2023, 11:39am UTC](https://users.rust-lang.org/t/practical-guides-on-no-std-and-wasm-support/94762 "2023-06-02T11:39:11Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![bjorn3](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/bjorn3/32/5255_2.png) [@bjorn3](https://users.rust-lang.org/u/bjorn3)\
**Post date:** [June 5, 2023, 8:08am UTC](https://users.rust-lang.org/t/practical-guides-on-no-std-and-wasm-support/94762/5 "2023-06-05T08:08:06Z")

</div>

Using the default allocator costs less than 8k with LTO after stripping debuginfo. I don't see a point in trying to use a lighter allocator, especially when any smaller memory allocator almost certainly increases memory usage due to increased fragmentation.

```rust
#[no_mangle]
pub fn foo() -> *mut u8 {
    Box::into_raw(Box::new(1))
}
#[no_mangle]
pub fn drop(a: *mut u8) {
    unsafe { Box::from_raw(a); }
}

```

```plaintext
$ rustc example.rs --target wasm32-unknown-unknown --crate-type cdylib -Copt-level=3 -Clto -Cstrip=debuginfo
$ ls -l
-rwxr-xr-x 1 bjorn3 bjorn3 7892 1 jan 1970 example.wasm

```

---

_[View the full topic](https://users.rust-lang.org/t/practical-guides-on-no-std-and-wasm-support/94762)._
