Rust 1.28 Improves Memory Use |
Written by Kay Ewbank |
Tuesday, 14 August 2018 |
More effective use of system memory at run time is the main improvement to the latest Rust, version 1.28. The improvements fall squarely into the original design goals for Rust, which set out to be safe, fast and concurrent without having a garbage collector. It is constructed so that problems are detected at compile time so that it can be used safely for systems programming. Rust was originally sponsored by Mozilla, and is intended for use in situations including embedding in other languages, writing programs with specific space and time requirements, and writing low-level code, like device drivers and operating systems. The first improvement is a newly stabilized global allocators that handle how programs in Rust obtain memory from the system at runtime.In previous releases,it wasn't possible to change the way memory is obtained, so developers had to use alternative options such as jemalloc or the system allocator depending on the underlying system. In this version the global allocator attribute is now stable, which allows Rust programs to set their allocator to the system allocator. Developers can also define new allocators based on the GlobalAlloc trait. In addition to the stabilized GlobalAlloc trait, other libraries have also been stabilized. In particular, NonZero number types can now be used to wrap around standard unsigned integer types to provide size optimization when there's no need to handle data that won't ever be zero. Cargo is the other main area to have received attention. Cargo is the Rust package manager, and it will no longer allow you to publish crates with build scripts that modify the src directory. The src directory in a crate should be considered to be immutable, according to the Rust developers. Work has also continued on the diagnostics options in this release, with an emphasis on error messages about formatting. Previously, you were only told that a format string was invalid; now, you're told the specific reason the format string is invalid. Rust 1.28 is now available on GitHub. More InformationRelated ArticlesRust 1.26 Adds Existential Types Rust 1.20 Adds Associated Contents Updated Rust Improves Documentation Rust Hits Stable 1.0 - So What? Rust 0.4 Full Integration of Borrowed Pointers
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |