Skip to main content
ananya
Associate II
Oct 31, 2019 1:12 PM UTC
Solved

Calculating the memory requirements for screens

Hello,

I want to calculate RAM requirement for one screen with some widgets and images.How can this be done.

This topic has been closed for replies.
Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
Nov 4, 2019 9:39 AM UTC

Hi @ananya​,

Here's a way of calculating the size of both worst case View (including widgets) + Presenter or just the size for any screen you want. Then you have some memory for OS / Heap potentially.

int main(int argc, char** argv)
{
 ....
 // Print out size information
 printf("*** Memory usage: ***\r\n");
 printf("Largest view %lu\r\n", (long unsigned int) sizeof(FrontendHeap::MaxViewType));
 printf("Largest presenter %lu\r\n", (long unsigned int) sizeof(FrontendHeap::MaxPresenterType));
 printf("Datamodel %lu\r\n", (long unsigned int) sizeof(Model));
 printf("Total: %lu\r\n", (long unsigned int) sizeof(FrontendHeap));
 
 printf("*** Screens: ***\r\n");
 printf("MyView%lu\r\n", (long unsigned int) sizeof(MyView));
...
}

This code can be run in the simulator.cpp main() method.

/Martin

5 replies

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
Nov 4, 2019 9:39 AM UTC

Hi @ananya​,

Here's a way of calculating the size of both worst case View (including widgets) + Presenter or just the size for any screen you want. Then you have some memory for OS / Heap potentially.

int main(int argc, char** argv)
{
 ....
 // Print out size information
 printf("*** Memory usage: ***\r\n");
 printf("Largest view %lu\r\n", (long unsigned int) sizeof(FrontendHeap::MaxViewType));
 printf("Largest presenter %lu\r\n", (long unsigned int) sizeof(FrontendHeap::MaxPresenterType));
 printf("Datamodel %lu\r\n", (long unsigned int) sizeof(Model));
 printf("Total: %lu\r\n", (long unsigned int) sizeof(FrontendHeap));
 
 printf("*** Screens: ***\r\n");
 printf("MyView%lu\r\n", (long unsigned int) sizeof(MyView));
...
}

This code can be run in the simulator.cpp main() method.

/Martin

ananya
ananyaAuthor
Associate II
Nov 4, 2019 12:22 PM UTC

When I tried with the above in the main function, I got the following error in IAR.

Error[Pe070]: incomplete type is not allowed

Error[Pe070]: incomplete type is not allowed  

Error[Pe070]: incomplete type is not allowed

ananya
ananyaAuthor
Associate II
Jan 3, 2020 10:45 AM UTC

Hi @Martin KJELDSEN​ ,

When we want to calculate the RAM memory required for GUI,should we consider sum of all the screens' memory requirement?

How should it be calculated?