swc_malloc 1.2.4

Configures the best memory allocator for each platforms
Documentation

This crate configures memory allocator.

The swc crates related to the node binding should depend on this crate.

Memory Allocator Selection Strategy

This crate configures the global memory allocator based on the target platform:

  • mimalloc: Used for most platforms (Windows, macOS, Linux x86_64 with glibc, Linux aarch64 with glibc). Provides excellent performance and memory efficiency.

  • jemalloc: Used for Linux ARM 32-bit (armv7) with glibc. This is because mimalloc has known issues on this architecture.

  • System allocator (default): Used for musl libc targets (Alpine Linux and other musl-based distributions). This is intentional and correct because:

  • WASM: Uses the default allocator for WebAssembly targets.

If you encounter segmentation faults on ARM64 or Alpine Linux during installation, the issue is likely not related to allocator configuration, but rather to binary loading or compatibility issues. See the postinstall.js script for troubleshooting options.