Heap Requirements for Graphics Objects
This page contains information for the Graphics Library found in Microchip Libraries for Applications (MLA). It is not relevant for the MPLAB® Harmony Graphics Library.
Memory Requirements for Graphics Applications
MPLAB XC16 Compiler | MPLAB XC32 Compiler | |||||
---|---|---|---|---|---|---|
Graphics Component | Flash | RAM | Heap | Flash | RAM | Heap |
Primitive Layer | 3285 | 66 | 0 | 8868 | 53 | 0 |
Graphics Object Layer Overhead |
2124 | 32 | 20 per Style Scheme |
5400 | 28 | 28 per Style Scheme |
Button | 1131 | 38 | 8 per Instance |
2748 | 12 | 44 per Instance |
Check Box | 1008 | 2 | 8 per Instance |
2320 | 4 | 36 per Instance |
Radio Button | 1114 | 14 | 26 per Instance |
2632 | 20 | 44 per Instance |
Slider/Scroll Bar | 2352 | 20 | 32 per Instance |
5720 | 24 | 44 per Instance |
Static Text | 792 | 8 | 22 per Instance |
1884 | 12 | 36 per Instance |
Progress Bar | 1072 | 12 | 24 per Instance |
2452 | 16 | 32 per Instance |
Group Box | 960 | 8 | 24 per Instance |
2124 | 12 | 36 per Instance |
Window | 807 | 2 | 24 per Instance |
1996 | 4 | 40 per Instance |
List Box | 2094 | 6 | 28 per Instance |
2580 | 12 | 44 per Instance |
Edit Box | 1008 | 2 | 26 per Instance |
2332 | 4 | 40 per Instance |
Meter | 2520 | 42 | 40 per Instance |
6788 | 40 | 68 per Instance |
Box | 1092 | 8 | 32 per Instance |
3228 | 12 | 40 per Instance |
All memory requirements are in bytes.
Calculating the Required Heap Size
Most of the graphical components require some amount of memory set aside for the heap. Just how much is needed is determined by adding the memory requirements of each component module in the created routine. The overhead of the Graphics Object Layer is always included along with the requirements of each instance of the objects used.
Example
For a PIC32 application which utilizes one style scheme and has one screen, which contains:
- Six button objects
- One dial object
- Two Meter objects
and requires the following memory (in bytes):
Flash | RAM | Heap | ||
Graphics Object Layer Overhead | 5400 | 28 | 28 | |
Button Objects (6X) | 2748 | 12 | 266 | = 44 bytes/Button X 6 Buttons |
Dial Object (1X) | 3228 | 12 | 40 | |
Meter Object (2X) | 6788 | 40 | 136 | = 68 bytes/Meter X 2 Meters |
466 | Bytes needed for heap |