A headless C++ benchmark that compares two memory management architectures for real-time audio processing.
Runs 100 audio blocks through two architectures and measures four memory concepts:
- Timing Unpredictability — heap allocations per audio block during steady-state processing
- Memory Churn — total
new()anddelete()calls during steady-state - Memory Fragmentation — largest contiguous free block before and after the run
- Concurrency Safety — two instances running simultaneously, checksum comparison
At the end it prints a comparison table to the console and writes results.json for the BenchmarkViewer.
Version A — Direct Allocation
Simulates a naive DSP architecture where effects allocate scratch buffers on every audio block using new and delete. Represents the current Equalizer codebase style.
Version B — System Class Architecture
Implements an AudioSystem class that owns a MemoryPool and exposes an IEffectFactory as a service. All memory is allocated once at startup. Zero heap allocations during steady-state processing.
- Windows 10 or later
- Visual Studio 2022
- CMake 3.20 or later
- C++20
mkdir build && cd build
cmake ..
cmake --build . --config Release.\Release\MemoryBenchmark.exeThis produces results.json in the Release\ folder. Open it with BenchmarkViewer to see the results visually.
> Version A - Direct Allocation
> Version B - System Class Architecture
Timing Unpredictability
Memory Churn
Memory Fragmentation
Concurrency Safety
Version A (Direct) 2/4 concepts passed needs attention
Version B (System Class) 4/4 concepts passed real-time safe
Results written to: results.json
Benchmark_Architectures/
BenchmarkTypes.hpp shared types, counters, timer, checksum
VersionA.hpp direct allocation architecture
VersionB.hpp System Class: AudioSystem + Factory + Pool
Benchmark.hpp four measurement functions
Report.hpp console output formatter
JsonExporter.hpp writes results.json
main.cpp entry point
CMakeLists.txt build configuration
BenchmarkViewer — Qt6 desktop app that reads results.json and displays the results in a terminal-style dashboard.