Misconception about module freezing #10428
-
Hello, I have read about module freezing and done manifest file according to that page: As I understand it is supposed to freeze some modules into firmware of ESP-32 by doing so, scripts would execute from flash memory rather than from RAM.
But when I try to import for example dht or other frozen module, those are still takes some space in RAM. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
As I understand, some RAM will still be used. For each frozen class there's a small 'stub' class instantiated in RAM that forwards across to the code residing on flash. However, significantly less memory should be used, compared with running the entire code from flash. |
Beta Was this translation helpful? Give feedback.
-
I assume that you have rebuilt the firmware after changing the manifest files. As a Matt said, freezing causes the code for be executed from flash, The data that is allocated by the code will still reside in RAM. And you will see that mem_free() decreases for every command executed from REPL. But that memory use is just temporary. To to compare the amount of memory being used by the import, you have to use something like |
Beta Was this translation helpful? Give feedback.
As I understand, some RAM will still be used. For each frozen class there's a small 'stub' class instantiated in RAM that forwards across to the code residing on flash. However, significantly less memory should be used, compared with running the entire code from flash.