3 ms·
Rust tries to circumvent the _need_ for manual allocation entirely by providing plenty of high level constructs (Box, Vec, Rc, etc.) that you can do to safely a
by kangalioo 6y ago
Rust tries to circumvent the _need_ for manual allocation entirely by providing plenty of high level constructs (Box, Vec, Rc, etc.) that you can do to safely and easily do what you might accomplish with manual memory allocation in C
- Const-me 6y agoAll these constructs are implemented in terms of unsafe code. This makes the unsafe API surface (which, in the context of security, becomes attack surface) very large. Compare to Java or C#. Vast majority of stuff, including these collections, are implemented on top of memory-safe primitives. Usually (unless explicitly writing unsafe code which most people don’t do), the only attack surface is the VM itself. The attack surface is much smaller in comparison, both JVM and CLR are very simple from the outside, 202 and 234 instructions, respectively. The attack surface is well-contained, third-party C# or Java libraries don’t patch the VMs, while unsafe rust is used in many third-party crates not just in the standard library. Also, these VMs are well-audited (most of the implementations are open source now) and widely used all over the industry, including very security sensitive applications like banks and military.