Comment by Animats

Comment by Animats 6 days ago

0 replies

> Yep. The right philosophy is to always put the allocation and deallocation code in the same language.

And on the same side of the API. Especially in Rust, he who allocates is responsible for deallocation. Rust's model likes that symmetry.

This example looks like someone going to considerable trouble to create a footgun, then shooting themself with it. More likely, this example exists because they're using some C library with terrible memory semantics, and this is a simple example to illustrate a problem they had with a badly designed real library.