Skip to content

arena: add public allocation interface#87

Merged
edsiper merged 4 commits into
masterfrom
arena-public-api
Jul 12, 2026
Merged

arena: add public allocation interface#87
edsiper merged 4 commits into
masterfrom
arena-public-api

Conversation

@edsiper

@edsiper edsiper commented Jul 12, 2026

Copy link
Copy Markdown
Member

Summary

  • expose raw request-lifetime allocation through cfl_arena_malloc() and cfl_arena_calloc()
  • add cfl_arena_memdup() and cfl_arena_strndup() helpers
  • add an options-based constructor with optional allocator callbacks and bounded geometric chunk growth
  • retain fixed-size chunks as the default and preserve the existing constructors
  • document alignment, zero-size, overflow, failure, reset, and lifetime semantics
  • extend unit, installed-consumer, and benchmark coverage

The arena remains opaque, and the API additions are source- and ABI-additive. Existing CFL arena users retain their current fixed-size allocation policy unless they explicitly select a larger maximum chunk size. This PR only provides the general interface; it does not migrate downstream consumers.

Validation

  • cmake -S . -B build-public-arena -DCFL_TESTS=On -DCFL_BENCHMARKS=On
  • cmake --build build-public-arena -j8
  • ctest --test-dir build-public-arena --output-on-failure (34/34 passed)
  • ASan/UBSan test suite with leak detection (34/34 passed)
  • focused arena tests under Valgrind (no leaks or errors)
  • installed-consumer configure, build, link, and execution
  • downstream builds/tests: cmetrics (20/20), ctraces (4/4), cprofiles (4/4)
  • Fluent Bit default build, including processor plugins
  • git diff --check

Benchmark support

The arena benchmark now compares fixed-size chunks with an optional bounded-growth mode. This is intended to support representative consumer-side measurements, including OTLP protobuf rendering, without claiming workload-specific performance from the synthetic benchmark alone.

edsiper added 4 commits July 11, 2026 18:07
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
@edsiper edsiper marked this pull request as ready for review July 12, 2026 01:23
@edsiper edsiper merged commit 369c781 into master Jul 12, 2026
55 of 57 checks passed
@edsiper edsiper deleted the arena-public-api branch July 12, 2026 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant