[Microbit-Python] memory error

Eric Snow ericsnowcurrently at gmail.com
Fri Oct 2 17:26:04 CEST 2015


On Fri, Oct 2, 2015 at 9:07 AM, Damien George <damien.p.george at gmail.com> wrote:
> Yes, doc strings do take up memory, so in our case (when trying to
> reduce memory usage) it's better to make them comments (which are just
> skipped over by the tokeniser).

Why not support an option to strip docstrings, similar to "python -O"?
 In fact, consider making docstring *preservation* an opt-in option.
That would probably suit the embedded space better.

-eric

>
> The example you give with lots of prints does indeed take up all the
> memory, so that's why it gives a MemoryError.  It's not easy to fix
> this, the microbit is just really low on RAM!  We could compile the
> python script to flash (instead of RAM) but that needs a bit of effort
> to get working.

I'd be interested in seeing something like this happen, though I can't
promise I could help much (for now).  Could it leverage the frozen
module support that already exists?

-eric


More information about the Microbit mailing list