Skip to main content
ananya
Associate II
October 31, 2019
Solved

Calculating the memory requirements for screens

  • October 31, 2019
  • 2 replies
  • 1567 views

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.
Best answer by Martin KJELDSEN

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

2 replies

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
November 4, 2019

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
November 4, 2019

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
January 3, 2020

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?