Repository navigation
perf: let the recycling frame allocator cache a wide fan-out - #485
Conversation
Each size class kept at most 16 blocks per thread and 16 more in the shared pool. A fan-out with more live frames than that sent every further allocation and free through the shared pool's mutex to the upstream allocator. Cached blocks are now linked through their own storage, so a bucket's capacity no longer depends on a fixed array. Each pool caches up to 256 KiB per size class. A thread keeps a burst's blocks only while it goes on using them. Each bucket tracks the fewest blocks it held since its last check. Every few thousand frees and refilled blocks on the thread, half of those idle blocks move to the shared pool, where any thread can reuse them, or go back to the upstream allocator when the shared pool has no room.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
[Medium impact] The PR appears safe to merge; no actionable issues were found.
|
|
An automated preview of the documentation is available at https://485.capy.prtest3.cppalliance.org/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-11-13 12:14:32 UTC |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #485 +/- ##
===========================================
+ Coverage 98.45% 98.49% +0.03%
===========================================
Files 135 135
Lines 7250 7364 +114
===========================================
+ Hits 7138 7253 +115
+ Misses 112 111 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
GCOVR code coverage report https://485.capy.prtest3.cppalliance.org/gcovr/index.html Build time: 2026-11-13 12:24:05 UTC |
Each size class used to keep at most 16 blocks per thread and 16 more in the shared pool. A fan-out with more live frames than that sent every further allocation and free through the shared pool's mutex to the upstream allocator.
Changes
::operator deletewhen the shared pool has no room.Worst-case cached memory is bounded by the caps: (threads + 1) × 1.5 MiB.
Tests
New tests cover a fan-out wider than the old caps, an idle burst that decays, a recurring burst that stays cached, an idle burst while the shared pool is full, and a thread that only allocates.
Related
cppalliance/corosio#416 pairs with this branch for its benchmarks.
Summary by CodeRabbit