Skip to content

[meta] Post-3.10.6 fixup: memory/size regressions #4709

Closed
4 of 5 issues completed
Closed

Description

@zackees

Tracking issue for regressions people reported after the 3.10.6 release.

Goal: ship a 3.10.7 point release that brings flash and RAM back close to 3.10.3 levels.

Sub-issues

Sub-issues

4 of 5 Issues completed
Loading 5 sub-issues

Activity

  1. changed the title [-]Post-3.10.6 fixup: memory/size regressions[/-] [+][meta] Post-3.10.6 fixup: memory/size regressions[/+] on Oct 6, 2026
  2. added a commit that references this issue on Oct 6, 2026
  3. zackees commented on Oct 6, 2026

    @zackees
    MemberAuthor

    Bloat investigation: 3.10.3 vs HEAD (3.10.6)

    Method: I built the same sketches with fbuild against a 3.10.3 worktree and against HEAD, then ran fbuild symbols on both ELFs and compared them.

    Results

    Board Sketch 3.10.3 flash / RAM HEAD flash / RAM Change
    esp32dev DemoReel100 287,930 / 23,690 352,120 / 26,892 +64 KB flash (+22%), +3.2 KB RAM
    esp32dev DemoReel100, FASTLED_LOG_VERBOSITY=0 — 314,752 / 26,876 the log-string pool accounts for 37 KB of the 64 KB
    teensy41 DemoReel100 (addLeds) 56,320 / 27,264 81,920 / 70,016 +42 KB RAM, +25 KB flash
    teensy41 typed Channel API, before / after #4708 fix 122,880 / 84,032 103,424 / 87,808 RAM1 (ITCM+data+bss) 114.8 KB → 95.2 KB (−19.6 KB)

    I could not reproduce the 2.5x jump from #4707 (741 KB) with stock examples on fbuild's Arduino core. It probably depends on features the reporter's sketch uses (for example FastLED.add(cfg), which calls enableAllDrivers() by design since #2459), or on PlatformIO's older IDF4 core. We still need the reporter's sketch.

    Where the bytes went

    ESP32 (+64 KB)

    1. Log-string pool, 50.7 KB of .flash.rodata. fbuild attributes it to SlimBridgeController<...>::SlimBridgeController(). Arduino/PlatformIO builds don't define NDEBUG, so FASTLED_LOG_VERBOSITY defaults to 1 and every FL_WARN/FL_ERROR literal stays linked. Building with -DFASTLED_LOG_VERBOSITY=0 saves 37 KB.
    2. The rest (~27 KB): the RMT5 ChannelEngineRMTImpl, ChannelManager, fl::printf formatting, esp_cache_aligned_malloc_internal, and a stray libnet80211/s_wifi_nvs (+2.9 KB).

    Teensy 4.x (+42 KB RAM on plain addLeds)

    1. ObjectFLEDDmaManager::bitdata: a fixed 38,400 B buffer in DMAMEM (RAM2), declared __attribute__((used)), so it is never garbage-collected. In 3.10.3 the Teensy 4 default was the bit-bang clockless driver, which needed no DMA buffer. ObjectFLED is now the default Bus::FLEX_IO driver, so every sketch pays for this buffer.
    2. Teensy 4: Channel API costs ~72 KB RAM1 because ChannelManager::instance() registers every driver #4708: initChannelDrivers() registered FlexIO + ObjectFLED + SPI_UNIFIED on the first ChannelManager::instance() call, so even the lean TypedChannel<Bus::X>::create() path linked every driver into ITCM (RAM1). Fixed in the linked PR.
    3. Other DMAMEM statics (sLpUartBuffer, sSpiBitPattern, 4 KB each) are also used, so whether they land in the image depends on LTO partitioning rather than on whether anything references them.

    Slowdowns found

    • Host example runner: since 2943ad963d (stub controllers moved onto SlimBridgeController), every stub show() runs real bit-bang wire timing (busy-spin per bit plus a sleep for the reset pulse). ArrayOfLedArrays / MultipleStripsInOneArray (1,080 shows) hit the 20 s watchdog every time. Fixed in the linked PR: stub delayNanoseconds / delayMicroseconds honour the fast-exit delay override. Runtime went from >20 s to 1.6 s.
    • fl_codec takes ~13 s in quick mode, close to the 20 s runner limit, so it times out on a loaded machine (passes in debug in 4 s).

    Fixed in the PR

    • Teensy 4: Channel API costs ~72 KB RAM1 because ChannelManager::instance() registers every driver #4708: Teensy 4 lazy init (initChannelDrivers()) now registers only the platform-default ObjectFLED engine. FlexIO-1 and SPI_UNIFIED register only via enableAllDrivers() / FastLED.add(cfg), which still enroll every driver with the same priorities.
    • Log defaults on tiny platforms: FL_WARN / FL_ERROR / FL_INFO / FL_PRINT are already compiled out when !SKETCH_HAS_LARGE_MEMORY. Only the literal-only FL_WARN_LIT / FL_LOG_LIT remain, and the LPC845 bring-up check needs them (ci/autoresearch/phases.py warn_ok), so the default is unchanged. On Uno Blink the difference was 4 bytes of RAM.
    • The stub timing fix above.

    Still open (need a decision)

    • ESP32/Teensy are large-memory tiers, so they still ship ~37–50 KB of log strings unless NDEBUG or FASTLED_LOG_VERBOSITY=0 is set.
    • The ObjectFLED 38 KB fixed bitdata buffer: size it to the actual LED count, or allocate it lazily.
    • Drop used from Teensy DMAMEM driver statics so unused drivers' buffers can be garbage-collected.
  4. zackees commented on Oct 6, 2026

    @zackees
    MemberAuthor

    Memory trimming update (PR #4710)

    Build 3.10.6 (HEAD at start) PR #4710
    teensy41 DemoReel100 (addLeds): ITCM (RAM1 code) 59,664 B 35,680 B
    teensy41 DemoReel100: flash 80 KB 56 KB
    teensy41 typed Channel API: RAM1 (ITCM+data+bss) 114,800 B 67,680 B
    teensy41 typed Channel API: RAM2 (.bss.dma) 64,160 B 51,872 B
    esp32dev DemoReel100: flash 352,120 B 345,504 B

    What changed:

    Still open: #4711 (ObjectFLED's fixed 38.4 KB double buffer; changing it needs hardware validation) and #4712 (ESP32 log-string pool default).

  5. zackees commented on Oct 6, 2026

    @zackees
    MemberAuthor

    All five sub-issues are fixed by merged PRs that passed CI and, where the change touches hardware behavior, a run on a real Teensy 4.0.

    Sub-issue Fix Validation
    #4708 Teensy Channel API RAM1 #4710 ci-full 121/121; teensy41 RAM1 114.8 KB → 67.7 KB
    #4713 DMAMEM statics kept alive #4710 ci-full; unused driver buffers dropped from RAM2
    #4712 ESP32 log string pool #4717 (errors-only default) ci-full 121/121; ESP32-S3 Blink −24.3 KB
    #4707 ESP32 flash regression #4710 + #4717 esp32dev DemoReel100 352,120 → 320,660 B
    #4711 ObjectFLED 38.4 KB buffer #4716 ci-full 121/121, plus Teensy 4.0 loopback PASS at 1/8/64/100/101 LEDs, growing and shrinking

    Other bugs fixed along the way:

    Still open as follow-ups:

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