Zig Bits 0x2: Using defer to defeat memory leaks
17 minute read Published: 2023-03-21Let's talk about how to detect memory leaks in Zig and avoid them by using the defer
statement.
Let's talk about how to detect memory leaks in Zig and avoid them by using the defer
statement.
I decided to start a new blog series called "Zig Bits" where I share interesting bits of information about the Zig programming language. This series will be especially for beginners because I'm also a beginner.
Recently I packaged my project git-cliff (changelog generator written in Rust) for NPM with the help of my friend @atlj. I thought this would be an interesting topic for a blog post since it has a certain technical depth about distributing binaries and frankly it still amazes me how the whole thing works so smoothly. So let's create a simple Rust project, package it for NPM and fully automate the release process via GitHub Actions.
Let's investigate how to generate random numbers without external dependencies in Rust.
Let's talk about how to develop an open sourcerer mindset.
I don't use Spotify or any other streaming platform for listening to music. Some call it old habits, some call it needless effort, but I'm very used to downloading MP3 files over the internet and putting them in a folder on my phone then using the whatever default media player I have installed. However, for a couple of years, I have been following a better and automated approach for taking my music offline and feeling a bit less like I'm in a consumerism bubble.
Recently one of my clients requested me to maintain their Rust project. It is a web server that is built with Rocket + Diesel and running stable for a couple of years now. Like any other Rust developer would do, the first thing that I checked was the outdated dependencies via cargo-outdated
. The result was close to what I expected: most of the dependencies were out-of-date. However, among all those crates, rust-jwt caught my eye. It was 12 minor versions behind!
A guide for spinning up your own instance of 0x0, a no-bullshit file hosting and URL shortening service.