# EnqueueZero Techshack 2019-15

antirez/sds (opens new window)

Simple Dynamic Strings C library.

Most C string lib design string data structure like below

struct yourAverageStringLibrary {
    char *buf;
    size_t len;
    ... possibly more fields here ...

While SDS design the data structure like below

| Len | Free | H E L L O W O R L D \n | Null term |  Free space   \
             `-> Pointer returned to the user.

Hacking Strings - Redis (opens new window)

The Redis string implementation is hidden behind an interface that accepts only character pointers.

1. Overview - Memory Management Reference 4.0 documentation (opens new window)

A well-designed memory manager can make it easier to write debugging tools, because much of the code can be shared. Such tools could display objects, navigate links, validate objects, or detect abnormal accumulations of certain object types or block sizes.

Typical memory management problems include:

  • Premature frees and dangling pointers
  • Memory leak
  • External fragmentation
  • Poor locality of reference
  • Inflexible design
  • Interface complexity

Erlang Garbage Collector | Erlang Solution blog (opens new window)

(opens new window)

Orca is a concurrent and parallel garbage collector for actor programs, which does not require any stop-theworld steps, or synchronisation mechanisms, and which has been designed to support zero-copy message passing and sharing of mutable data

Atoms ELI5 - BEAM VM Wisdoms (opens new window)

Atom is a symbol which does not change its value in runtime. BEAM loader routine reads atom values and looks them up in atom table. It replaces atom names with their integer values, tagged as Atom immediate. These internal values cannot leave the node (over the network or on disk) as integers. This is because another node will have different numeric values for atoms. Thus when leaving the node atoms are always converted to strings.

mrb: What Is Declarative Programming? (opens new window)

This post is part of a series exploring a brain-melting epic known as Concepts, Techniques, and Models of Computer Programming.

Writing a Simple Garbage Collector in C (opens new window)

The hardest part in writing a GC is writing the memory allocator, which is as hard to write as it is to look up the malloc example in K&R.

EdgeDB 1.0 Alpha 1 (opens new window)

EdgeDB Alpha 1 released. Some significant features:

  • No NULL. Everything is a set. Nothing yields to an empty set. Boolean logic only need to handle true and false.
  • Enhanced JSON support. SELECT <json>Person { full_name, name_len:=len(.fullname) }
  • Type safety. SELECT <local_datetime>'2019-01-01 01:01:01';.
  • Meta Programming using annotations. This enables building type checking, etc.

# Further Readings

GopherCon 2018 - Allocator Wrestling (opens new window)