Hacker News new | ask | show | jobs
by pcwalton 1702 days ago
Memory safety also adds reliability, by catching bugs statically that you didn't catch during (automated or manual) testing. It's the same argument as for static typing.

It's of course true that some developers may judge the tradeoffs differently for their individual projects—that's why they're tradeoffs! But there are benefits to memory safety that go beyond security.

1 comments

the only memory safety gamedev needs are bound checking and use after free protections

everything else is just bloat and noise that hurts iteration time

and even if one would still value them, you'd need to check only once for whatever memory check you want to run, when you build your allocators for example, and not at every builds, and you could even write the logic yourself and have a debug allocator to ensure memory safeties

you want sub second and not "double digit seconds" build times

it takes one to try to make a game to trully understand why iteration time is far more important that anything else (other than performance of course)

you don't want to wait multiple seconds everytime you change the speed of your character, or tweak the rendering/AI code

that's why then some devs end up using scripting language and they loose all the advantages of their native language, because they want to speed up iteration time

that's why i personally stick to D for my game, my engine + game fully rebuild in under 1 second

you don't get to create memory bugs when you work on your gameplay code ;)

> the only memory safety gamedev needs are bound checking and use after free protections

Probably if your game is single-threaded …

Rust's raison d'être was type-check thread-safety, and even if we don't talk about this aspect much anymore it's still the domain where it has no competitors (Pony could have been, but didn't get traction).

And it's invaluable.

> the only memory safety gamedev needs are bound checking and use after free protections

Disagree, but in any case, we're talking about the fact that Zig doesn't provide use-after-free protection.

Zig is allocator aware, use after free protection is covered with the ``GeneralPurposeAllocator``
Is GeneralPurposeAllocator the one that quarantines memory forever? That isn't practical, as I've mentioned before. To name one problem, allocating 1 byte in a 4kB page leaks the entire page.