Compilation and RAM usage FAQ
Compilation and RAM usage FAQ
Conceptually, why does a large script run out of RAM when it is compiled?
What is the relative ratio of usage of RAM (heap vs stack)?
Codewise, which part of the code causes RAM to be depleted (and is it heap vs stack)?
What is the relative ratio of usage of RAM (heap vs stack)?
Codewise, which part of the code causes RAM to be depleted (and is it heap vs stack)?
Re: Compilation and RAM usage FAQ
If I run one line (or block) at a time of a `.py` via the REPL API (as in pyexec.c:pyexec_raw_repl()), will I eliminate the issue of running out of RAM during compilation?
i.e. for N lines in a `.py` file, will my peak RAM usage during compilation be more, less, or same if I feed in one line at a time vs compile the entire N lines at once?
I understand it'll be much slower but let's say I was running out of RAM during compilation and didn't care about speed.
i.e. for N lines in a `.py` file, will my peak RAM usage during compilation be more, less, or same if I feed in one line at a time vs compile the entire N lines at once?
I understand it'll be much slower but let's say I was running out of RAM during compilation and didn't care about speed.
Re: Compilation and RAM usage FAQ
If I compile the N lines separately, is it possible to stitch together the resulting bytecode returned by
into one mp_raw_code_t ?
Code: Select all
mp_raw_code_t *rc = mp_compile_to_raw_code(parse_tree, source_file, emit_opt, is_repl);
Re: Compilation and RAM usage FAQ
It's probably easier to pre-compile to mpy file on a PC
Re: Compilation and RAM usage FAQ
It is but in some cases it’s not an optionchrismas9 wrote:It's probably easier to pre-compile to mpy file on a PC
Sent from my iPhone using Tapatalk
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Compilation and RAM usage FAQ
@jickster Have you read http://docs.micropython.org/en/latest/p ... ained.html? In particular the section on the heap.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Compilation and RAM usage FAQ
pythoncoder wrote:@jickster Have you read http://docs.micropython.org/en/latest/p ... ained.html? In particular the section on the heap.
Which sections answer my questions?
Sent from my iPhone using Tapatalk
Re: Compilation and RAM usage FAQ
Where’s the answer to this?
jickster wrote:If I compile the N lines separately, is it possible to stitch together the resulting bytecode returned by
into one mp_raw_code_t ?Code: Select all
mp_raw_code_t *rc = mp_compile_to_raw_code(parse_tree, source_file, emit_opt, is_repl);
Sent from my iPhone using Tapatalk
Re: Compilation and RAM usage FAQ
Which section gives the answer to this questionpythoncoder wrote:@jickster Have you read http://docs.micropython.org/en/latest/p ... ained.html? In particular the section on the heap.
jickster wrote:If I compile the N lines separately, is it possible to stitch together the resulting bytecode returned by
into one mp_raw_code_t ?Code: Select all
mp_raw_code_t *rc = mp_compile_to_raw_code(parse_tree, source_file, emit_opt, is_repl);
Sent from my iPhone using Tapatalk