【问题标题】:MemoryError: memory allocation failed MicropythonMemoryError:内存分配失败Micropython
【发布时间】:2022-01-22 09:54:35
【问题描述】:

我正在使用带有很多组件的 ESP32 卡,特别是 ssd1306 屏幕,我找到了一个可以在屏幕上放置字母的库,简而言之,当我在测试中调用该库时遇到问题问题是这个:

Traceback (most recent call last):
File "main.py", line 25, in <module>
File "hello_world.py", line 1, in <module>
MemoryError: memory allocation failed, allocating 136 bytes

我把图书馆放在这里:https://github.com/nickpmulder/ssd1306big/blob/main/ssd1306big.py

还有我的世界:

import ssd1306big
import time

write = ssd1306big

while True:

write.clear()

write.wrap("Hello")

time.sleep(5)

【问题讨论】:

    标签: esp32 micropython


    【解决方案1】:

    如果您有很多组件和库并希望最大限度地减少内存使用量,您有两个选择:将库冻结到固件中(最佳内存优化选项)或使用 mpy-cross 将库“编译”成字节码以降低内存使用率. https://github.com/robert-hh/Shared-Stuff

    【讨论】:

      猜你喜欢
      • 2014-06-24
      • 2017-06-11
      • 1970-01-01
      • 2016-05-01
      • 2013-02-19
      • 2011-12-12
      • 2011-08-23
      • 1970-01-01
      相关资源
      最近更新 更多