3 ms·
no, in zig it's never unexpected, because if you're freeing memory the freesite is known, it's a function call.
by dnautics 5mo ago
no, in zig it's never unexpected, because if you're freeing memory the freesite is known, it's a function call.
- josephg 5mo agoRight; because in zig the default behaviour is to leak memory. Rust adds an invisible free() call. Leaking is something you have to do explicitly. I understand zig's philosophy here. But I prefer rust's default behaviour.
- dnautics 5mo agoyeah, IMO generally explicit is better. It's hard to take something implicit and increase the visibility (I'm aware there are tools to show you lifetimes in rust). But another option is to statically analyze the code (or the IR) and have something else check that you aren't leaking.
- bnolsen 5mo agoZig fails unit tests if there's a memory leak in those tests.