Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understand (and solve if trivial) MemoryErrors when using MicroPython #84

Open
krzema12 opened this issue Nov 30, 2021 · 1 comment
Open
Labels
bug Something isn't working

Comments

@krzema12
Copy link
Owner

krzema12 commented Nov 30, 2021

For example, when running e2e tests with micropython instead of python3, I got:

Traceback (most recent call last):
  File "python/e2e-tests/out/python-consumer.py", line 1, in <module>
  File "/home/piotr/repos/priv/kotlin-python/python/e2e-tests/out/compiled.py", line 12986, in <module>
MemoryError: memory allocation failed, allocating 26032 bytes

Looking at box tests report, >1000 tests fail with this reason. The good thing is that it's fairly reproducible: for a given box test, it always fails with such MemoryError.

My suspicion is that too much code is fed to micropython. Kotlin/Python doesn't do any Dead Code Elimination for now (to be done in #102), and the compiler output weights ~420 KiB.

@krzema12 krzema12 added the bug Something isn't working label Nov 30, 2021
@krzema12 krzema12 changed the title Understand and solve MemoryErrors when using MicroPython Understand (and solve if trivial) MemoryErrors when using MicroPython Nov 30, 2021
@krzema12 krzema12 added this to the MicroPython support milestone Nov 30, 2021
@LouisCAD
Copy link

LouisCAD commented Dec 3, 2021

Quoting myself for reference:

Just thought about this: the issue might be about the implications of instantiating a NotImplementedError. Maybe it's worth trying to raise a custom thing/error/exception to see what causes this?

Isn't that related to the cost of building the stacktrace? I don't know how that works in Python, but I wouldn't be surprised to learn that it works differently in MicroPython, or that it's just not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants