Documentation Index
Fetch the complete documentation index at: https://mine-27913f41.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
What is Zinc?
Zinc is a shared memory library. It lets programs in different languages share data by reading the same physical memory. No copies. No serialization. No network overhead. Normally, sharing data between programs means copying it — through a socket, pipe, or file. For large data (megabytes or gigabytes), those copies are slow and wasteful. Zinc eliminates them. It maps the same RAM pages into every participating process. One program writes, the others read — instantly. The core is written in Rust and compiles to a shared library (libzinc_core.so on Linux, .dylib on macOS) with a stable C ABI. Every language adapter (Rust, Python, Go, Node.js, Bun, Deno, C++, Java, C#) calls the same eight C functions through its native FFI mechanism. No logic is reimplemented in adapters. No serialization format is imposed. The shared memory is the API.
The problem
When two processes on the same machine need to share data, every default option involves copying. Unix sockets copy from the sender buffer into kernel space, then from kernel space into the receiver buffer. A Redis or gRPC round-trip serializes structured data to bytes, ships them across a transport, then deserializes on the other side. Every byte of that tensor, frame, or struct was already sitting in RAM. None of that copying is necessary. It is a tax you pay for process isolation. For small payloads under 64KB this tax is negligible (a few microseconds). For payloads measured in megabytes or gigabytes, it becomes architecturally significant. A 100MB tensor serialized and sent over a socket takes roughly 100 milliseconds. Reading the same 100MB from shared memory takes roughly the same time as any memory read: sub-millisecond. That is not a performance improvement. It is a category change in what becomes practical.How it works
At the lowest layer, Zinc callsshm_open (Linux and macOS) to create or open a shared memory segment. The resulting file descriptor maps into the process address space with mmap. The first 64 bytes of every mapping hold a versioned header: the creator’s PID, a reference count, a notification sequence counter, and capacity. Everything after the header is user data.
Each language adapter wraps the C ABI in native types. Python returns a memoryview (or a numpy.ndarray for numeric data). Go returns a []byte slice backed by the mmap. Node returns a Buffer. All of them point to the same physical pages. No copies.
Ownership model
The process that creates a shared memory region owns it. Only the creator can callshm_unlink, which removes the segment name from the system. Other processes open the region by name, which bumps an atomic reference count in the 64-byte header. When a handle drops or closes, the count decrements. When the creator’s handle drops and the count hits zero, the segment unlinks automatically.
The Rust core enforces this at the type level: SharedRegion::create returns a handle with owner privileges, SharedRegion::open returns one without. There is no way to promote an opener to an owner. The C ABI preserves the distinction internally.
