Skip to content

declaring an "big buffer" on esp32-s3 (16MB Flash & 8Mb RAM) need "long" time to recover connection after crash #17279

@chf-6309

Description

@chf-6309

Port, board and/or hardware

esp32-s3 "generic" (from AliExpress) YD-ESP32-23 / 2022-v1.3

MicroPython version

MicroPython v1.25.0 on 2025-04-15; Generic ESP32S3 module with Octal-SPIRAM with ESP32S3

Reproduction

#LCD TFT size
width = 320
height = 480

# === Create a framebuffer RGB888 (3 bytes per pixel) ===
def create_framebuffer(width, height):
    return bytearray(width * height * 3)  # 460800 bytes - 461KB

called from main program:
buf = create_framebuffer(width, height)

Expected behaviour

with 8MB available RAM, expect that, even is the buffer isn't used, the access to the esp32 card will be possible.
The size of that buffer should be around 460KB, small compared to the 8MB available

When my program crash during tests, after the buffer allowance, it need minutes or more, to recover the USB link to the card, or before I include an:

del buf
gc.collect()

at the end of the program.

The fastest way is to do an hard RESET

Observed behaviour

the esp32 need minutes (more than five) before communication with PC and (portable) Thonny v4.17 is (again) possible, without the use of the hard reset.

First I didn't use the "Generic ESP32S3 module with Octal-SPIRAM with ESP32S3" firmware, so, the available RAM was little as ~300KB. Withe the Octal version I get;

Mémoire libre : **8312704 octets** [free memory]
stack: 736 out of 15360
GC: total: 64000, used: 8832, free: 55168, max new split: 8257536
 No. of 1-blocks: 176, 2-blocks: 22, max blk sz: 32, max free sz: 3410

MicroPython v1.25.0 on 2025-04-15; Generic ESP32S3 module with Octal-SPIRAM with ESP32S3

Type "help()" for more information.

>>> import gc
>>> gc.mem_alloc()
**10640**
>>> gc.mem_free()
**7785024**

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions