3 ms·
Is the stack trace saying that the Rust parser tickles a bug in jemalloc or somehow uses it unsafely? A parser (which uses malloc) seems like a pretty basic us
by chubot 12y ago
Is the stack trace saying that the Rust parser tickles a bug in jemalloc or somehow uses it unsafely?
A parser (which uses malloc) seems like a pretty basic use case for 100% safe code.
When I think of unsafe code, I think of needing to make raw syscalls, libc calls, or inline assembly. Not string manipulation and malloc.
I am not super familiar with Rust, but I imagine you don't have to use unsafe {} every time you need to malloc, right?
- kibwen 12y agoThe only reason that the parser was using unsafe code is because it is an extremely old part of the codebase, and likely required the unsafe blocks to hack around some deficiency in the compiler from Rust 0.3 or alike. Recent efforts to overhaul the parser have reduced this dramatically: there are two legitimate remaining uses of `unsafe` (dealing with libc stuff), and four uses of `unsafe` that all have associated FIXMEs.
- steveklabnik 12y agoKibwen is correct with regards to the parser, but I'd also like to mention that in Rust, you generally don't call malloc yourself. It's actually not even possible in stable Rust, though a high priority API we'd like to stabilize.