In my case it was a lot of human readable data and thus quite verbose
It is automatically executed when you run Modules.addCached - so your original verbose text version will no longer exist in memory. I'd check process.memory().usage and make sure you're actually freeing yourself a lot of memory and not just making your life difficult:
This is done on a linux-based Espruino so the memory usages might be different, but you get the idea.
>Modules.addCached("foo","/* lots and lots of text here */exports.hello = function() {};")
=undefined
>process.memory().usage
=32
>foo = require("foo")
={
"hello": function () {}
}
>process.memory().usage
=33
>Modules.removeAllCached()
=undefined
>process.memory().usage
=32
Removing the module from the cache saves just one memory block - the one with the module's name in.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
It is automatically executed when you run
Modules.addCached
- so your original verbose text version will no longer exist in memory. I'd checkprocess.memory().usage
and make sure you're actually freeing yourself a lot of memory and not just making your life difficult:This is done on a linux-based Espruino so the memory usages might be different, but you get the idea.
Removing the module from the cache saves just one memory block - the one with the module's name in.