Jaculus
Jaculus copied to clipboard
Improve module loader
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