Hey!
Because I am quite near the memory limits (after 2 iterations of trying to get it smaller) I would like to understand what areas of code take up what parts of the memory. I add some example code, maybe that helps me understand all that a little bit better
I refactored as much Strings as somehow possible for the UI to be F(), I have every function in my UI classes as FLASHMEM function. All the dynamic project data (Tracks, Instrument-Configurations, tons of Notes- and Modulation data) is dynamically allocated into PSRAM. The structs that hold that data have some helper functions, mostly for initialization and for the UI. Those are marked as FLASHMEM also. All the UI -relevant classes are dynamically created during runtime to keep it away from RAM1.
and still I use up newly all of the available memory and receive that compile error from time to time when I am hitting the limit. Yes it’s a lot of Code (Drawing all those individual screens and every screen needs custom IO -event handling, but still, can that be over 300k of Code?
Is there a way to Analyse the code to see what functions and what classes/structs take up how much space?
maybe this helps me to find the part, where I might be doing something wrong or where I could change it, so I can continue to add features.
Because I am quite near the memory limits (after 2 iterations of trying to get it smaller) I would like to understand what areas of code take up what parts of the memory. I add some example code, maybe that helps me understand all that a little bit better
Code:
uint32_t global_var = 0; // takes up 4 bytes in RAM 1 because it is global
struct TestStruct {
uint32_t a;
uint32_t b;
uint32_t c;
uint32_t d;
}; // where does the definition of this struct go?
TestStruct* test_struct_ptr = 0; // takes up 4 Byte in RAM1 als pointer to the memory?
FLASHMEM void flash_func() {
// with content
} // stays ins flash memory and does not take up RAM1 right?
void main() {
test_struct_ptr = new TestStruct(); // takes up 16 bytes in RAM2 because it’s allocated dynamically
} // main is going to the start of RAM1 because of FASTRUN or at least somewhere else in RAM1?
I refactored as much Strings as somehow possible for the UI to be F(), I have every function in my UI classes as FLASHMEM function. All the dynamic project data (Tracks, Instrument-Configurations, tons of Notes- and Modulation data) is dynamically allocated into PSRAM. The structs that hold that data have some helper functions, mostly for initialization and for the UI. Those are marked as FLASHMEM also. All the UI -relevant classes are dynamically created during runtime to keep it away from RAM1.
and still I use up newly all of the available memory and receive that compile error from time to time when I am hitting the limit. Yes it’s a lot of Code (Drawing all those individual screens and every screen needs custom IO -event handling, but still, can that be over 300k of Code?
Is there a way to Analyse the code to see what functions and what classes/structs take up how much space?
maybe this helps me to find the part, where I might be doing something wrong or where I could change it, so I can continue to add features.