kotlin-python icon indicating copy to clipboard operation
kotlin-python copied to clipboard

Understand (and solve if trivial) MemoryErrors when using MicroPython

Open krzema12 opened this issue 2 years ago • 1 comments

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 avatar Nov 30 '21 12:11 krzema12