Skip to content

fix(memory): account for and reduce remaining Uno Blink RAM gap versus 3.10.3 (+37 B) #4788

Closed

Description

@zackees

Context

The maintainer reports that the dashboard still does not match3.10.3 memory usage after #4784. Verified directly against the currently published data/latest.json and both Uno Blink symbol reports; this is a real remaining RAM increase, not stale dashboard data.

Matched Uno Blink 3.10.3 master after #4785/#4786 Delta
Physical static RAM 131 B 168 B +37 B (+28.2%)
Allocated image flash 3784 B 3762 B −22 B
Attributed symbol RAM 153 B 194 B +41 B; includes aliased vtables
.bss 89 B 118 B +29 B
.data 42 B 50 B +8 B

Baseline source 20667c3a6413ed46a828f78ec95fb57e58d753f8; measured master 619b7763a9eae5ff3d899fded553835c8e61cdf7. Both measurements published2026-10-08 at09:40–09:41 UTC, fbuild2.5.38, same protocol 8afb003767857d9147b6bbddddc95432bd3d4fe83f38ed10f4ef050ba4ca67a2, AVR GCC7.3.0-atmel3.6.1-arduino7, Arduino AVR core5.4.0, default Uno configuration and matched no-Serial Blink. A fresh local build of this master SHA independently reproduces3762/168.

Evidence: published measurements, 3.10.3 symbols, merged-master symbols.

Where every remaining byte goes

Count each physical address range once: ClocklessController and NEOPIXEL vtables alias the same storage. Summing both aliases would falsely add another4 bytes to the growth.

Retained allocation 3.10.3 master Physical increase Cause / source touch point
gControllersData 16 32 16 B src/FastLED.cpp.hpp: MAX_CLED_CONTROLLERS is now16 for any FL_IS_AVR_ATMEGA, including Uno328P. Sixteen two-byte pointers replace eight. src/platforms/avr/is_avr.h confirms328P satisfies the broad family macro. The comment says Mega/Leonardo, but the condition includes Uno.
Base-controller vtable 20 24 4 B Two retained additional virtual slots: setSpiBus(Esp32SpiBus) (a no-op on AVR) and fixedWhiteChannelChipset() (white-policy enforcement). src/fl/channels/cled_controller.h.
Clockless/NEOPIXEL vtable, shared allocation 22 26 4 B The same two inherited slots enlarge the concrete vtable. Count its two reported aliases once.
Concrete NEOPIXEL controller 24 27 3 B Compact LegacySettings still differs from3.10.3: current white config is variant<Empty,Rgbw,Rgbww>, versus old Rgbw mRgbMode; audit exact AVR field sizes before selecting a packing change. No new emitter/source profile state remains.
Global FastLED object 13 15 2 B mLastRequestedScale and mLastShownScale added for power-limiter status (#4425), src/FastLED.h.
timer_millis 0 4 4 B Weak fallback counter retained alongside Arduino timer0_millis. src/platforms/avr/avr_millis_timer_source.cpp.hpp broadly enables its definition, and avr_millis_timer_null_counter.hpp provides storage. Uno's MS_COUNTER already selects timer0_millis; do not confuse this with a missing Arduino counter.
sWaitSpinBudgetUs 0 4 4 B Mutable Channels wait budget in src/fl/channels/detail/wait_spin_budget.cpp.hpp. Report associates its retained storage with startup initialization. Minimal legacy Blink does not configure this Channels setting.
Total 37 B Exactly reconciles29-byte .bss +8-byte .data increase.

The old one-byte dither state and current gDitherFrame are a replacement, not an additional byte. LED pixels, Arduino millis/overflow state, FPS counters, controller list pointers, guard variable, and lastshow do not contribute to the net gap.

Why the previous fix did not reach3.10.3

#4784 intentionally isolated ChannelOptions/new profiles and excluded unrelated controller scratch-array and timer work. It removed98 bytes RAM (266→168) and152 bytes flash (3914→3762), but its success criteria were the measured ownership correction, not historical131-byte parity. The remaining37 bytes come from the independent allocations above. The current dashboard has already incorporated both merged PRs.

Proposal

  1. Record this exact37-byte physical allocation ledger as the remaining Uno Blink regression under chore(memory): redo uno baseline with Blink without Serial #4764. Preserve before/after ELF, maps, reports and provenance; do not use old Serial-enabled results.
  2. Investigate the highest-return default storage first: restore the intended small-AVR controller-slot capacity policy with an explicit override for callers needing16 slots; eliminate unused Uno fallback-counter retention without breaking ATtiny/other cores; prevent Channels wait-budget state from being retained by a legacy-only sketch.
  3. Audit whether AVR needs the SPI-host virtual slot and whether fixed-white policy can remain correct with less RAM. Preserve actual chipset white-policy enforcement, not just default Blink behavior.
  4. Investigate the remaining controller field packing and power-status bytes separately. Preserve correction, temperature, dithering, RGBW/RGBWW, power limiting/status, multi-controller registration/show lifecycle and explicitly used APIs. Do not remove caller-used features merely to hit the benchmark.
  5. Measure each change on matched Uno Blink. Target default physical RAM <=131 B, while maintaining allocated flash <=3762 B and existing size ratchets. Document any proven irreducible cost or compatibility tradeoff for maintainer decision before claiming parity.

Acceptance criteria

  • Focused RED→GREEN evidence before each fix: a failing memory/layout/linkage regression or matched budget repro, followed by implementation passing the same signal.
  • Publish matched3.10.3/current/final measurements with physical RAM, allocated flash and deduplicated symbol/section delta ledger; account for every remaining byte and preserve ELF/maps/provenance.
  • Default Uno Blink physical RAM reaches<=131 B without new profile state, unexpected Serial linkage, raised budgets or removal of supported caller-used functionality; an unmet target remains explicit and requires maintainer agreement rather than declaring parity.
  • Flash remains<=3762 B and relevant existing budget ceilings only tighten to observed values.
  • Verify controller-capacity defaults/overrides and registration/show/endShow lifecycle; preserve traditional settings, RGBW/RGBWW/fixed-white policy, power/status APIs, Arduino millis and clockless interrupt compensation, and affected ATtiny/core timer behavior.
  • Run relevant local sequential board builds/tests, lint and review; publish merged PR/source SHA and final dashboard-compatible measurements.

Decisions

Open questions

  • Which remaining allocations can be removed or packed while preserving supported AVR behavior? The physical37-byte total is proven; final achievable savings require targeted experiments.
  • Confirm exact per-field AVR white-variant layout and fallback-counter linker retention before selecting those fixes.

Related issues

#4784 (completed profile/Channels ownership correction), #4764 (open Uno matched-baseline work), #4760 (open parent memory comparison), #4735 (broader Nano caller-used-feature footprint).

Activity

  1. zackees commented on Oct 8, 2026

    @zackees
    MemberAuthor

    Maintainer decision for #4790: approved making CLEDController::size(), beginShowLeds() and endShowLeds() non-virtual on AVR (VIRTUAL_IF_NOT_AVR) to save 12 B of vtable RAM on Uno. Accepted tradeoff: custom AVR controllers can no longer override these three hooks. The in-tree RGBW/WS2816 wrappers use OVERRIDE_IF_NOT_AVR, and on AVR the base version saves and restores their own dither. With #4789 and #4790, matched Uno Blink is 118 B RAM / 3592 B flash, below 3.10.3's 131 / 3784.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions