![]() |
VOOZH | about |
dotnet add package ZeroBuffer --version 1.2.8
NuGet\Install-Package ZeroBuffer -Version 1.2.8
<PackageReference Include="ZeroBuffer" Version="1.2.8" />
<PackageVersion Include="ZeroBuffer" Version="1.2.8" />Directory.Packages.props
<PackageReference Include="ZeroBuffer" />Project file
paket add ZeroBuffer --version 1.2.8
#r "nuget: ZeroBuffer, 1.2.8"
#:package ZeroBuffer@1.2.8
#addin nuget:?package=ZeroBuffer&version=1.2.8Install as a Cake Addin
#tool nuget:?package=ZeroBuffer&version=1.2.8Install as a Cake Tool
👁 NuGet
👁 PyPI
👁 vcpkg
👁 License: MIT
A high-performance, zero-copy inter-process communication library with implementations in C++, C#, and Python. This ring-buffer implementation is designed for low-latency data transfer between processes, particularly for video streaming applications.
Supported platforms: Linux, Windows, macOS (Python/C#), with platform-specific optimizations.
The protocol is based on structure called zero-buffer(name):
The SHMB:
Fixed size Operation info exchange block (64-byte aligned)
Fixed size Metadata block (64-byte aligned)
Fixed size Payload block (64-byte aligned)
Each item in the Payload's buffer is defined by the structure: 8B: Payload size 8B: Payload sequence number (unsigned long long) dynamic: Payload data
Operation exchange block is used to inform reader and writer about how much data has been written or read. 8B: Operation size
8B: Metadata size 8B: Metadata free bytes 8B: Metadata written bytes
8B: Payload size 8B: Payload free bytes 8B: Payload written bytes 8B: Payload written count 8B: Payload read count
8B: Writer PID (process ID of writer, 0 if no writer attached) 8B: Reader PID (process ID of reader, 0 if no reader attached)
Metadata is a structure that allows the writer to specify detailed information about the schema it will write. The reader might not know exactly what data to expect. The metadata block has the following structure:
A Python docker container (reader) uses the zerobuffer to exchange data with streamer (writer) that would run in a different container on the same host machine. The python docker container would create zero-buffer and writes zero-buffer connection-string in json-rpc on std-out, that is started with '>' char:
{ "jsonrpc": "2.0", "method": "start-stream", "params": [ "e39640a7-50e4-4261-ac92-d9e09e480074", 1024, 2048] }
the rocket-welder2 reads this from log and thus can run gstreamer with proper parameters passed to the pipeline.
gst-launch-1.0 testvidoersrc ! zero-sink name="e39640a7-50e4-4261-ac92-d9e09e480074"
the zero-sink plugin, would then write the metadata and than frames to the zero-buffer based on the passed name: "e39640a7-50e4-4261-ac92-d9e09e480074".
/tmp/zerobuffer/{name}.lock (Linux) or appropriate temp directory (Windows)${name} (using POSIX shm_open on Linux, CreateFileMapping on Windows)sem-w-${name} and sem-r-${name} (using POSIX sem_open on Linux, CreateSemaphore on Windows)The write client queries the size of metadata size and data size.
The client verifies there is enough free bytes in metadata block
The client writes metadata to shared memory. The metadata is prefixed with its size (protocol-level), can be then serialized via protobuf (application-level, not protocol level).
Given the client wants to write a frame (certain amount of bytes):
When writing a message of size N bytes:
Where:
A wrap marker is a special FrameHeader with:
payload_size = 0 (indicates this is a wrap marker, not a real frame)sequence_number = 0 (wrap markers don't have sequence numbers)When the reader encounters a wrap marker:
Important: Wrap markers are implementation details, not logical frames.
This ensures symmetric semaphore behavior: one signal per logical frame on both sides.
To ensure correct visibility of data across processes:
Memory Barriers:
OIEB Update Order:
Sequence Number Validation:
Basic Formula:
payload_size = max_frame_size * 3 + overhead
overhead = frames_in_flight * sizeof(FrameHeader)
Where:
max_frame_size: Largest frame you'll writeframes_in_flight: Expected frames between write and readsizeof(FrameHeader): 16 bytes (8B size + 8B sequence)1080p @ 30 FPS Video (6MB frames):
max_frame_size = 6MB
frames_in_flight = 3 (100ms buffer @ 30fps)
payload_size = 6MB * 3 + 3 * 16 = 18MB
Recommended: 20MB (with padding)
4K @ 60 FPS Video (25MB frames):
max_frame_size = 25MB
frames_in_flight = 6 (100ms buffer @ 60fps)
payload_size = 25MB * 3 + 6 * 16 = 75MB
Recommended: 80MB (with padding)
Telemetry Data (1KB @ 1000Hz):
max_frame_size = 1KB
frames_in_flight = 100 (100ms buffer @ 1000Hz)
payload_size = 1KB * 3 + 100 * 16 = 4.6KB
Recommended: 8KB (with padding)
The OIEB provides real-time buffer health information:
utilization = (payload_size - payload_free_bytes) / payload_size * 100%
Applications should monitor payload_free_bytes and log warnings when entering degraded state.
[Created] -> [Waiting] <-> [Reading] -> [Processing] -> [Waiting]
| |
v v
[Error/Dead] [Shutdown]
[Connecting] -> [Connected] -> [Writing] <-> [Blocked] -> [Writing]
| | | |
v v v v
[Error] [No Reader] [Reader Dead] [Shutdown]
Note: ZeroBuffer is designed for trusted internal use only. It provides:
For secure IPC, consider encrypted alternatives. ZeroBuffer optimizes for lowest latency in trusted environments.
📚 for complete documentation structure
Configure the custom registry in your vcpkg-configuration.json:
{
"registries": [
{
"kind": "git",
"repository": "https://github.com/modelingevolution/zerobuffer-vcpkg-registry",
"baseline": "YOUR_BASELINE_HERE",
"packages": ["zerobuffer"]
}
]
}
Then install:
vcpkg install zerobuffer
Or use CMake with vcpkg toolchain:
find_package(zerobuffer CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE zerobuffer::zerobuffer)
# Package Manager Console
Install-Package ZeroBuffer
# .NET CLI
dotnet add package ZeroBuffer
# PackageReference in .csproj
<PackageReference Include="ZeroBuffer" Version="1.0.*" />
# Install from PyPI
pip install zerobuffer-ipc
# Or install with specific version
pip install zerobuffer-ipc==1.0.0
#include <zerobuffer/writer.h>
#include <zerobuffer/reader.h>
// Writer
zerobuffer::Writer writer("my-buffer", 1024*1024, 64*1024);
writer.connect();
writer.write(data, size);
// Reader
zerobuffer::Reader reader("my-buffer", 1024*1024, 64*1024);
auto frame = reader.read();
using ZeroBuffer;
// Writer
using var writer = new Writer("my-buffer", 1024*1024, 64*1024);
writer.Connect();
writer.Write(data);
// Reader
using var reader = new Reader("my-buffer", 1024*1024, 64*1024);
var frame = reader.Read();
import zerobuffer
# Writer
writer = zerobuffer.Writer("my-buffer", 1024*1024, 64*1024)
writer.connect()
writer.write(data)
# Reader
reader = zerobuffer.Reader("my-buffer", 1024*1024, 64*1024)
frame = reader.read()
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 2 NuGet packages that depend on ZeroBuffer:
| Package | Downloads |
|---|---|
|
RocketWelder.SDK
High-performance video streaming client library for RocketWelder services with zero-copy shared memory support |
|
|
RocketWelder.SDK.Server
Server-side library for testing RocketWelder SDK containers. Simulates GStreamer by sending frames via DuplexChannel and reading AI results from sockets. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.8 | 3,357 | 10/15/2025 |
| 1.2.7 | 228 | 10/15/2025 |
| 1.2.6 | 226 | 10/15/2025 |
| 1.2.5 | 222 | 10/13/2025 |
| 1.2.4 | 392 | 9/18/2025 |
| 1.2.3 | 352 | 9/18/2025 |
| 1.2.2 | 361 | 9/17/2025 |
| 1.2.1 | 357 | 9/17/2025 |
| 1.2.0 | 361 | 9/17/2025 |
| 1.1.20 | 222 | 10/15/2025 |
| 1.1.19 | 546 | 8/31/2025 |
| 1.1.18 | 236 | 8/31/2025 |
| 1.1.17 | 258 | 8/31/2025 |
| 1.1.16 | 249 | 8/30/2025 |
| 1.1.15 | 249 | 8/30/2025 |
| 1.1.13 | 252 | 8/30/2025 |
| 1.1.12 | 274 | 8/30/2025 |
| 1.1.11 | 372 | 8/25/2025 |
| 1.1.10 | 176 | 8/22/2025 |
| 1.1.9 | 197 | 8/22/2025 |