-
Notifications
You must be signed in to change notification settings - Fork 688
Description
With my current development i am facing a problem in which i cannot allocate enough memory to load from the file system a program that should fit on JerryScript.
Arduino 101 has 80kb of RAM (divided in two MCUs, so only 55kb are for Zephyr and JS), 256kb of ROM and 1MB of slow FLASH memory.
I store several javascript programs of different sizes on that flash which i load and run one after the other.
The current approach to load a javascript program is to copy it to memory and then call the parser.
jerry_parse (const jerry_char_t *source_p, /**< script source */
size_t source_size, /**< script source size */
bool is_strict) /**< strict mode */
That means that the whole code has to be loaded in memory in one go, so i have to allocate it.
That memory will be freed instantly after the parser has finished.
I am not sure how feasible would be to have a simple API to pass a function that will do the reading for jerryscript and implement the fread functionality on the port, abstracting the reading from the memory to a callback would allow us to load from disk bigger programs and save memory usage.