Use-after-free is not always detected, but it is safe because it avoids using the same memory addresses, thereby preventing memory corruption. This test has an undetected use-after-free bug, however, its behavior is still well-defined and no memory corruption occurs.

Show thread

The Zig standard library is finally gaining a general purpose allocator. Importantly, it is *safe*. Here it is integrated with Zig's unit tests, catching memory leaks and double-free.

The next Zig SHOWTIME will be something different.

Rather than speakers as usual, there will be special announcements regarding the future of the project.

One week from Saturday. Don't miss it.

zig.show

I'm going to start a live stream in about 30 min. The topic will be Zig self-hosted compiler status update + demo, Tracy integration demo, and then all aboard the pull request merge train.

twitch.tv/andrewrok

Silly but fun demo of self-hosted Zig progress:

asciinema.org/a/ZZ9h3zM86E9pVC

It compiles a zig source file with 1,000,000 calls to print("hello world") in 0.67 seconds using 471 MiB resident memory. This is 8x as fast as clang on equivalent C code and 3x less memory.

The show where members of the Zig community share code and ideas.

zig.show

I had an idea to improve the Zig tokenizer, and it turned out to be a good one!

throughput: 279 MiB/s => 347 MiB/s

Check out the diff - it's a great demo zig's comptime feature.

github.com/ziglang/zig/pull/54

I worked this week on improving performance of the self-hosted parser in Zig. Thanks to the new benchmark tracking project, I have graphs to show for my efforts!

The Y axes of the "time" graphs is a ratio from a fixed previous commit. maxrss is peak bytes of RAM used.

I should clarify: it's using libclang, which is a C++ library. There is a C API wrapper on top of that. Then it is Zig code that uses the libclang C API wrapper to translate C code into Zig source code, format it, and write it to a file.

But this is definitely a meaningful step towards a self-hosted compiler! Today 5,156 lines of C++ were deleted from the Zig source repository.

And now most open issues with regards to translating C code are labeled as "contributor friendly"
🥳

Show thread

Thanks to many contributors, but especially Vexu, `zig translate-c` is now fully self-hosted.

Example:

Today, thanks LemonBoy's contributions, Zig
gained Tier 2 support for MIPS!

Mastodon

Server run by the main developers of the project 🐘 It is not focused on any particular niche interest - everyone is welcome as long as you follow our code of conduct!