malloc() and free() are a bad API

Redis Explained

Parent links in Go ASTs

Understanding, Detecting and Localizing Partial Failures in Large System Software [pdf]

Issue #267



I was traveling most of last week with an unpredictable schedule, so couldn't make time to send out issues.
I wrote an article recently on optimizing queries for polygon intersection using PostGIS. Let me know what you think.
The overwhelming response from the last issue was that longer summaries = good. A few people did say they prefer the shorter summaries, since it motivated them more to read the actual article (easier to skip out on reading the long article if you can just read the relatively short summary). I think the longer summaries provide more value though, so I'm going to stick with them. I do want to say that although I generally do a good job at summarizing, there is definitely a chance that I might miss some important information that might be very relevant to you. Therefore, if there was even a smidgen of a chance that you would read an article before reading the summary, I highly recommend you still read the full article.
Anyway, here's the issue.


malloc() and free() are a bad API

Published: 31 August 2022
Tags: c, c++

The article discusses the shortcomings of the C memory allocation functions malloc() and free(), and how they could be improved. The main problems are that they don't allow for specifying custom alignment, don't store metadata about the allocated memory, and can waste space. Jonathan Müller proposes a new interface that would solve these problems.
Other highlights:

  • C++17 and C++23 have made some improvements to operator new and std::allocator to address some of the problems with the C allocation functions, but there are still some shortcomings
  • Rust doesn't have these problems (lol)


Redis Explained

Published: 11 August 2022
Tags: redis

Mahdi Yusuf wrote "a deep technical dive into all things Redis. Covering various Redis topologies, data persistence and process forking".
Other highlights:

  • Redis is an open-source, in-memory, key-value database server.
  • Can be used as a cache in front of another "real" database like MySQL or PostgreSQL to help improve application performance
  • Offers enough guarantees that it can be used as a full-fledged primary database
  • Redis is single-threaded
  • Redis persistence models include RDB Files and AOF
  • Forking is a way for operating systems to create new processes by creating copies of themselves
  • With Redis, forking is made possible by a memory sharing technique called copy-on-write


Parent links in Go ASTs

Published: 3 September 2022
Tags: go

Eli Bendersky flips through a number of different approaches to finding the parent of a node in an AST in Go. Other highlights:

  • AST nodes in Go do not have parent links, which can make it difficult to find a node's parent, or more generally, all the ancestors of a given node
  • There are a few different ways to find a node's parent in an AST: the ad-hoc approach, keeping manual track of parents, using Inspector.WithStack, or with PathEnclosingInterval
  • The ad-hoc approach is the simplest, but it is not very reusable
  • Keeping manual track of parents is more work, but it is more reusable
  • Using Inspector.WithStack is the most work, but it is the most reusable
  • With PathEnclosingInterval is the least work, but it is the least reusable


Understanding, Detecting and Localizing Partial Failures in Large System Software [pdf]

Published: 25 February 2020
Tags: networking, research paper

Chang Lou, Peng Huang, and Scott Smith present "OmegaGen, a static analysis tool that automatically generates customized watchdogs for a given program by using a novel program reduction technique" to aide in catching partial failures in distributed systems.

How did I do?

1 2 3 4 5


Want to help and get cool stuff?

Thank you for reading! If you enjoy the newsletter, I would really appreciate you helping me spread the word by forwarding this to your friends and colleagues or sharing it on social media! Get cool stuff for your referrals using your link or the buttons below.

Your referrals:

If you want to discuss or comment on this issue, head on over to this page at A Byte of Coding. You can also subscribe there if you're new!

Have comments or feedback? Just reply to this email or hit me up on Twitter @AByteOfCoding.

Email landed in your promotions tab? Please move it over to primary so you don't miss the latest issues in the future.
Thanks for your Support! 

Thanks to sponsors and supporters like Євген Грицай, Scott Munro, zturak, pek, Emil Hannesbo, Joe Hill, Astrid Sapphire, Gregory Mazzola, moki scott, Michael, Matt Braun, Tim Nash, Christoffer, and Mike Rhodes this newsletter is provided to you for free. If you'd like to also show your support and buy me a monthly meal, you can donate on the Patreon page. It's not necessary, but it lets me know that I'm doing a good job and that you're finding value in the content.

Stats (updated daily)

Sent: 2954

Opens: 1408

Clicks: 526

Link Clicks Clicks % Unique Clicks Unique Clicks %
malloc() and free() are a bad API 113 31.92% 122 31.52
Redis Explained 148 41.81% 162 41.86
Parent links in Go ASTs 35 9.89% 38 9.82
Understanding, Detecting and Localizing Partial Failures in Large System Software [pdf] 58 16.38% 65 16.80


Back to Issues