Accessibility

Table of Contents

Memory management and optimizations in Flash Lite

How Flash Lite stores and manages data

SWF

Based on the design set by the device manufacturer, Flash Lite either stores a reference of the SWF data buffer from the host or makes a copy of the host buffer. If the SWF file is compressed, Flash Lite always makes a copy of the uncompressed data. The easiest way to find is to measure the memory available to Flash Lite player (described later in the article) after the SWF file is loaded. So, in summary, some memory is consumed right after your movie is loaded.

Flash Lite keeps the SWF data buffer (or a reference to it) in the static memory heap for the whole life time of the player. This applies also to external Movie Clips that are loaded by using the  loadMovie ActionScript command (unless they are freed by using the unloadMovie command).

Images

Image data in Flash Lite consists of a set of coordinate values for each curve and fill that comprises the image. The image data of a graphic that is converted to a symbol, bitmap, or text is stored only in the first key-frame in which the symbol appears. Each subsequent frame using the graphic stores only the changes. If the graphic is not converted, the data is stored in each and every frame the graphic appears requiring more memory. In the case of animated symbols; however, the data is stored in each frame.

When the player comes across an image in the animation, it decompresses it into memory before rendering so that it can access the pixel data rapidly. Memory for decompressed images is allocated in the dynamic heap (if available), otherwise in static pool.

Sound

Data of event sound is stored in the first key-frame in which they appear. Each subsequent frame using the sound only stores the changes to that sound.

URL data

  • XML or text
    While loading XML or text, the whole file is loaded into the static memory heap. Based on the device manufacturer and OS, some limitations may be imposed by the device. This document on LiveDocs gives more insight on this.
  • Audio and video
    When a player is given a URL of an audio or video to play back, the player just passes the URL to the device to play back and does not allocate any memory. The memory required is handled by the OS directly.

Fonts
Since embedded fonts are part of the SWF itself, memory is allocated right at the beginning in the static memory pool. This could take up a lot of memory depending on the font. Device fonts on the other hand use the fonts in the device and do not require any additional memory.