Announcement 📢 Releasing smartalloc

If you happen to write unsafe code in Rust where normal static checks are not available and want better UX for detecting memory issues along side using various sanitizers, checkout my new crate smartalloc which provides idiomatic Rust binding for the original C version here.

Beside the reason in README, note that MIRI can’t be used now since it doesn’t support FFI function call. With Rust 1.65.0-nightly running

cargo +nightly miri run --example undetected

results the error

error: unsupported operation: can't call foreign function: sm_malloc
 --> examples/
5 | #[global_allocator]
  | ------------------- in this procedural macro expansion
6 | static GLOBAL: SmartAlloc = SmartAlloc;
  |                ^^^^^^^^^^ can't call foreign function: sm_malloc
  = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
  = note: BACKTRACE:
  = note: inside `_::__rg_alloc` at examples/
  = note: this error originates in the attribute macro `global_allocator` (in Nightly builds, run with -Z macro-backtrace for more info)

note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.