Skip to content

fix(memory): reduce esp32s3 default flash/RAM usage (#4737) #4741

Closed

Description

@zackees

Context

Platform sub-issue of #4737. +36,217 B flash / +2,353 B RAM versus 3.10.3.

Source measurements, flash / RAM in bytes, fbuild 2.5.37, per-version source/examples and constant per-board build configuration. Reference SHAs: 3.10.3 20667c3a64, 3.10.6 ebf8c2823c, master 0c2e9f7300.

Pinned ESP32 framework: Arduino-ESP32 3.3.11 / ESP-IDF 5.5.5.

example 3.10.3 3.10.6 master reference
Blink 371515 / 75863 436540 / 80008 407732 / 78216

Execution workflow

Work one checklist item and one platform sub-issue at a time across the entire #4737 project, in the existing repository checkout without git worktrees. Use a feature branch in that checkout and reuse .build/fbuild/esp32s3, toolchain/dependency caches and test caches. Run builds sequentially. Verify changed source/flags are reflected in the ELF; use the appropriate wrapper's --clean only when stale-output evidence requires it. Record each completed item's measurements, checks and commit/PR before moving on.

Checklist

  • Reproduce this platform's current starting measurements with recorded SHA, flags and framework versions, and verify cache validity.
  • Create matched symbol/link-map evidence using bash bloat esp32s3; retain both the published example and controlled RGB-workload measurements where applicable.
  • Attribute RMT/channel objects, buffers, memory management and optional global state.
  • Audit driver binding, unused encoders and archive/unity boundaries; coordinate with Eliminate memory usage from dynamic driver binding. #4733.
  • Reduce default flash and RAM while preserving driver timing, supported outputs and network coexistence; retain the existing logging savings.
  • Land measured default flash and RAM reductions below the recorded master values for every example in this child, and quantify remaining gaps to 3.10.3.
  • Add a focused size regression check. For any implementation, capture a failing budget/reproduction before coding (RED) and the passing result afterward (GREEN); run relevant tests, lint and code review.
  • Ratchet applicable existing flash budgets and enforce RAM budgets through existing checks, preserving normal feature behavior and avoiding relaxed ceilings.
  • Publish final before/after bytes, remaining gaps, source SHA, commands, flags, framework versions and landed commit/PR links; update meta(memory): reduce default flash/RAM usage across all measured platforms #4737's platform scorecard.

Decisions

  • Default-build reductions are required; optional slim configurations supplement the work but do not satisfy this child.
  • Scope is this platform; shared fixes must be measured on affected siblings and tracked in the parent.
  • Any unmet reduction criterion needs an explicit maintainer-approved exception with exact bytes before closure.

Activity

  1. zackees commented on Oct 7, 2026

    @zackees
    MemberAuthor

    Matched S3 evidence and enforced budgets are in PR #4754, candidate dbb1c555f6; checks/review are running, so this child remains open.

    workload 3.10.3 matched original master current master003083fa28 saved flash/RAM
    published Blink 371515 / 75863 407716 / 78216 407068 / 78008 648 / 208
    controlled RGB 371515 / 75863 407488 / 78216 406840 / 78008 648 / 208

    Board flash/physicalRAM bytes; same fbuild2.5.37, Arduino-ESP323.3.11/IDF5.5.5/XtensaGCC14.2.0, normaldefaults, no slimopt-in. Fresh originalmaster0c2e9f7300 published differs from frozen407732 by16flash, so matched648 is the attributed saving;664 below frozen is separately recorded. Remainingpublished3.10.3gap35553/2145; controlled35325/2145.

    Original/master fbuild bloat and physical-section ledger saved. Image367279→366603; attributedRAM38503→38323 (distinct from physicalRAM). New scopedRAM/imagebudget and existinggate enforce those values; baseline367407→366603. Originalmaster retrospectivebudgetRED676image/180attrib, currentGREEN; oldgateRED804unclaimedheadroom, updatedgateGREENzeroheadroom. This PR enforces shared source reductions already landed in completed siblings, whose preimplementationRED/GREEN/runtimeevidence remain linked in PR4753; no newdriverbehavior claim.

    Full lint, selectedPythonbudget/gate inventory, and threefilemanualreview PASS. FreshS3SDKcompile PASS. Genuine failures retainwarnings; routineRMT limits alreadyFL_LOG_RMT, no loggingfl::printf in measured ESPpath. Unsafe compactcounts and resourceguard changes rejected where customlimits/thread/lifetimebehavior could change. No featuresremoved/newworkflow/raisedceiling/worktree/CI Full. All builds local/sequential and cachespreserved.

    After merge: fresh landedgate, cumulativeparentdiff, closeonly4741. Parent4737 remainsOPEN; Teensy40/Teensy41/RP2040 follow oneatime.

  2. zackees commented on Oct 7, 2026

    @zackees
    MemberAuthor

    Landed PR #4754 at 0c2e7841e2d56735b475ab25571a8d15fe79dda4. Candidate and landed trees match. Fresh local landed S3 compile and existing flash/RAM gate pass: board 407068 / 78008 B; image 366603 B; attributed RAM 38323 B.

    Matched original master published 407716 / 78216 → 407068 / 78008; controlled 407488 / 78216 → 406840 / 78008. Both save 648 B flash / 208 B physical RAM. Matched 3.10.3 is 371515 / 75863 for both workloads. Remaining gaps: published +35553 / +2145, controlled +35325 / +2145.

    The shared reductions already landed in earlier children; this PR verifies S3 and enforces the savings through the existing gate. Retrospective original-master budget RED and current GREEN, headroom ratchet RED/GREEN, lint, selected Python budget/gate tests and manual review pass. All ordinary PR checks passed; CodeRabbit approved without findings. No native behavior changes or features removed.

    The cumulative parent diff reports 2792 B flash / 1006 B physical RAM saved across eight published rows. Complete version/source/toolchain/workload evidence is in the PR and prior progress comment. Builds/tests ran locally and sequentially in the existing cached checkout, without worktrees or CI Full.

    Closing this validated child. Parent #4737 remains OPEN. Next: Teensy 4.0 #4745, then Teensy 4.1 #4746 and RP2040 #4747.

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