Skip to content

MemoryError with simple imports on Pico W on 9.0.0-alpha6 #8736

Closed as not planned
@michalpokusa

Description

@michalpokusa

CircuitPython version

Adafruit CircuitPython 9.0.0-alpha.6 on 2023-12-12; Raspberry Pi Pico W with rp2040

Code/REPL

import gc

print("Before import", gc.mem_free())
try:
    import adafruit_datetime
    # from adafruit_datetime import datetime
except Exception as e:
    print(e)
print("After import", gc.mem_free())

Behavior

Importing some libs on 8.2.9 works as expected, and allocates only a small portion of memory, the same code/imports on 9.0.0-alpha6 errors with MemoryError, and despite not importing the module uses nearly all available memory.

From my testing this does not happen on ESP32-S2, but maybe this is due to the higher amount of memory on these boards.

Description

Importing whole library on 8.2.9.
image

Importing only datetime class on 8.2.9.
image

Importing whole library on 9.0.0-alpha6.
image

Importing only datetime class on 9.0.0-alpha6.
Notice how despite not importing the lib successfully, the gc.mem_free() returns a 4k (I guess bytes).

image

Additional information

My guess is, CircuitPython 9.x.x changed something regarding memory allocation. I was able to find this live from Adafruits YT channel, when they show something that looks like the problem presented here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions