[SOLVED]mp_parse - guideline on memory

C programming, build, interpreter/VM.
Target audience: MicroPython Developers.
Post Reply
jickster
Posts: 629
Joined: Thu Sep 07, 2017 8:57 pm

[SOLVED]mp_parse - guideline on memory

Post by jickster » Wed Apr 25, 2018 8:35 pm

I was compiling a script and I got an out of memory error in the parser.

My heap size is 4096 bytes.

I would like some guidelines on how to guestimate the amount of heap the parser will use based on the .py file
Last edited by jickster on Mon May 07, 2018 6:26 pm, edited 1 time in total.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: mp_parse - guideline on memory

Post by dhylands » Wed Apr 25, 2018 10:40 pm

I'm not sure that such a guideline exists. It probably depends quite a bit on the contents of the script (i.e. how the parse tree winds up looking).

You should either split the file into smaller chunks, or use frozen bytecode (then all of the compiling happens on the host). You could also transfer bytecode (.mpy) files rather than .py files. The .mpy files will still use RAM (whereas with frozen bytecode at least the bytecode come from flash not RAM).

Post Reply