Closed bjorn3 closed 6 years ago
Thanks, that’s a great catch. I’ll rewrite it and see if jemalloc gets happier.
You are first extending the three input vecs with zeros, which is undefined behaviour as zero may not be a valid value for the types.
Is this true? It's all floats and ints under the surface. Regardless, the alignment and sizing of the types is still making behavior undefined here.
Is this true? It's all floats and ints under the surface.
Nope it isnt true, I should have looked more carefully at the types.
jemalloc works now!
6b5722b062a56c8c5eee1b361b26c11c035c616b d043f8ed30cdda79aaabc7cb635385a8231e33af 0a65cf24b456f0e2d28489c868b57bfd8be8f8bf
Great catch, thanks!
https://github.com/bfops/playform/blob/bf71fd54cb21631d9423ab7dc41d46a851b81a09/client/lib/src/view/chunked_terrain.rs#L76-L118
You are first extending the three input vecs with zeros, which is undefined behaviour as zero may not be a valid value for the types. Then you are turn the vecs into raw ptrs and create them again, with a different length, which is not allowed according to the docs. (https://doc.rust-lang.org/nightly/std/vec/struct.Vec.html#safety) I suspect this of causing the jemalloc deadlock.
Could you please rewrite it in safe rust.