Skip to content

How to deal with small heap on ESP32-C3 #11879

Open

Description

@dhalbert

#10093 pointed out MemoryError problems on ESP32-C3 when using adafruit_httpserver. The amount of free RAM available on startup is ~83 kB, and that must be shared between the VM heap and ESP-IDF needs like mbedTLS.

For instance, if an HTTPS server is started, about 33 kB of system heap is needed for the listening socket, and about 26 kB more for each connected client. That leaves minimal space for program, libraries and data.

We might consider freezing some network libraries to make this chip more usable.

Activity

  1. added this to the Long term milestone on Nov 14, 2026
  2. lynt-smitka commented on Nov 14, 2026

    @lynt-smitka

    Summarized numbers by Claude from my ESP32-C3 tests on 11.0.0-alpha.2, with adafruit_httpserver and HTTPS:

    • The BLE workflow is on by default and takes 66 to 70 KB. Without it 148 KB is free, not 78.
    • server.start() fails even with 98 KB free. The heap doubles from 63 to 126 KB for a 3 KB object.
    • wrap_socket takes 22.8 KB up front, also for the listening socket.

    This works on the released firmware. The server starts and two more TLS sockets fit:

    CIRCUITPY_BLE_WORKFLOW = false
    CIRCUITPY_HEAP_START_SIZE = 73728
    
    adafruit_httpserver heap flash
    from /lib 48.7 KB
    frozen 14.7 KB +34.7 KB
    imported in place from CIRCUITPY, my WIP 24.8 KB +640 B
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions