4 ms·
There's support for exactly this type of OOM testing in Zig via std.testing.checkAllAllocationFailures: - https://github.com/ziglang/zig/blob/1606717b5fed83ee6
by squeek502 3y ago
There's support for exactly this type of OOM testing in Zig via std.testing.checkAllAllocationFailures:
- https://github.com/ziglang/zig/blob/1606717b5fed83ee64ba1a91e55248e07a51afa6/lib/std/testing.zig#L972-L1124 https://github.com/ziglang/zig/blob/1606717b5fed83ee64ba1a91...
- https://www.ryanliptak.com/blog/zig-intro-to-check-all-allocation-failures/ https://www.ryanliptak.com/blog/zig-intro-to-check-all-alloc...
- olodus 3y agoOh cool, didn't know that. Thanks.
- astrange 3y agoThis is a clear sign of a badly designed language. You should never see a fixed-size (less than page size) allocation fail, simply because there's nothing you can reasonably do if it does fail. Either you should crash or it should block until it is possible again. (Where crash means a worker process or something limited to something less than the entire system. See Erlang for the logical extension of this.) I realize this implies Windows and Java are badly designed and my answer to that is "yes".
- matheusmoreira 3y agoSo if my browser tries to allocate memory for a tab and the allocation fails it should just crash or block instead of handling the failure gracefully by not creating a new tab and telling me the system is running low on memory?
- astrange 3y agoTabs are separate processes in every modern browser. Actually since you skipped all the less than a page stuff I'm not sure you actually understand what my post is about…?
- gnubison 3y agoIs Linux designed in such a way that less-than-page size allocations never fail? How would that work?