In an effort to ensure Android is secure and stable, Google has announced the Android Open Source Project (AOSP) will support Rust for developing the operating system. According to the company, memory safety bugs continue to plague code and memory-safe programming languages like Kotlin, Java and Rust help prevent these bugs from happening in the first place.
“Rust provides memory safety guarantees by using a combination of compile-time checks to enforce object lifetime/ownership and runtime checks to ensure that memory accesses are valid. This safety is achieved while providing equivalent performance to C and C++,” Jeff Vander Stoep and Stephen Hines from the Android Team wrote in a post.
RELATED CONTENT: What’s all the fuss about Rust?
Google uses Java and Kotlin languages for Android app development due to their ease of use, portability and safety. The Android operating system uses Java to prevent memory bugs, but the lower layers of the OS require languages such as C, C++ and Rust, Stoep and Hines explained.
“These languages are designed with control and predictability as goals. They provide access to low level system resources and hardware. They are light on resources and have more predictable performance characteristics,” they wrote.
However, Stoep and Hines explained it is easy to make mistakes in C and C++ and comes with limitations such as the need to consume additional overhead and introduce latency.