[erlang-questions] Erlang VM in Rust

scott ribe <>
Fri Sep 22 13:08:36 CEST 2017


> Probably you're lucky. Last time I worked on a C code, there was a
> mysterious (but thankfully reproducable) crash. According to the core
> file the process tried to follow a null pointer variable, but if I
> checked the memory where the variable was, it was not null. I went
> down to the assembly code and the contents of the registers, there was
> nothing that explained the crash. The variable was in a structure that
> was initialized at startup, then never written. In final despair I
> moved the initialization from runtime to compile time and made that
> structure const hoping that the compiler/linker/kernel will put the
> structure into read-only memory so if anything tries to write to it,
> I'd get the crash at that time. Guess what happened: the original
> crash went away. Probably the memory was reorganized in a way that the
> stray overwrite now didn't touch this particular variable. And no,
> memory debuggers didn't help, ElectricFence didn't found the error,
> Valgrind didn't worked in that environment. I'm so glad that I don't
> have to work on that kind of C code anymore.

And that's why I'm hesitant to ever start another major project in C. I've got them out there that are pretty reliable, but it takes a lot of work to get to that point, and one single tiny error within a huge code base can lead to what you describe.

--
Scott Ribe

(303) 722-0567



More information about the erlang-questions mailing list