During some testing using the emulator and pushing the code to RAM I found the following oddity while logging the output from process.memory(), the same occurs if I run on the watch via RAM. If I push the code to a storage file and its run from there it works more as I would expect.
I have a test method inside an instance of an App class which runs for the duration of the program as follows:
setup = () => {
this.route = RouteHelper.loadRoute('feature_test');
this.nav.setRoute(this.route);
this.nav.setZoomLevel(5);
this.nav.startRoute();
//print mem here
// BangleMock.start();
};
printing out the memory at the comment part of the above script gives around 2000 free. Its the same if I do this outside the method after the block has finished.
If I add a timeout to print the memory usage after a few seconds:
That code block doesn't contain any async functions. Does anyone have some insight into why a big chunk of memory is being freed a few seconds after execution, rather than at the end of each block scope.
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.
During some testing using the emulator and pushing the code to RAM I found the following oddity while logging the output from process.memory(), the same occurs if I run on the watch via RAM. If I push the code to a storage file and its run from there it works more as I would expect.
I have a test method inside an instance of an App class which runs for the duration of the program as follows:
printing out the memory at the comment part of the above script gives around 2000 free. Its the same if I do this outside the method after the block has finished.
If I add a timeout to print the memory usage after a few seconds:
Free memory jumps to around 9000.
That code block doesn't contain any async functions. Does anyone have some insight into why a big chunk of memory is being freed a few seconds after execution, rather than at the end of each block scope.