The Flash Lite player allocates memory for its various structures dynamically. The structures can be rendering objects, images, ActionScript objects, sound, XML, or any other feature or player functionality. To ensure predictable performance, Flash Lite reserves a fixed-sized chunk of memory from the operating system (OS) to create what is called a static memory heap. This memory is reserved when the player starts up and the size is defined by the device manufacturer.
The OS (based on design by the manufacturer) can optionally provide the player with additional memory called dynamic memory heap. Flash Lite does not reserve any memory for this heap when it starts up and allocates memory dynamically from the OS as needed. However, the device manufacturer defines an upper bound on how much memory the host OS will give the player in total. Both static heap and dynamic heap can grow until they have (combined) used the total amount specified.
The player responds to all memory requests by first trying to allocate from the static heap. If it doesn't find any memory available in the static heap, the player tries to allocate from the dynamic heap, in chunks of 32 KB and adds it to the static heap – growing the size of static heap. If dynamic memory is not available, the player exits out with error. The player reverses the memory allocation order for rendering objects and JPEG images. It first tries to allocate memory from the dynamic heap, if available. If not, it tries to allocate from the static heap. So, in summary, Flash Lite 2.x uses dynamic memory (if available) to store for JPEGs and rendering objects. For all other structures, it uses static memory.
When the player is paused or put on background, memory allocated from the dynamic heap (for decompressed JPEGs and rendering objects) can be freed and given back to the OS. When the memory from the static memory heap is freed (explained later in the article), the player does not give the memory back to the OS but re-uses it for new objects as needed. So, the static heap never reduces in size.