Jaculus icon indicating copy to clipboard operation
Jaculus copied to clipboard

Improve module loader

Open yaqwsx opened this issue 3 years ago • 0 comments

The current module loader does not handle well large modules. The reason for that is the implementation of Duktapes node modules:

  • it expects the source to be loaded into RAM (first allocation)
  • the module loader then prepends the function header (second allocation: header size + source size)

With sources > 25kB this becomes troublesome as the memory is usually fragmented, therefore, the allocation fails.

Proposed solution:

  • read the file sources into a buffer with extra space on the beginning (for the header).
  • this requires rewriting the module loader (basically adapt the Duktape source into our tree and modify it).

Difficulty: Easy

yaqwsx avatar Aug 04 '21 15:08 yaqwsx