Livecode Wiki

Reports the size of memory that is in use for caching decompressed image data.Syntax:

get the imageCacheUsage


get the imageCacheUsage

Use the imageCacheUsage to determine how much memory is used to cache all decompressed image data.

In the event of running out or memory, the image cache operates a least-recently-used policy. This means that if an image needs to be decompressed and there is not sufficient cache space, then the images that have not been used for the longest time are discarded until there is sufficient space to add the new image.

If an image has the alwaysBuffer property set to true, then it is decompressed into the cache on card open. Images are processed from lowest layer to highest. If the number of images with the alwaysBuffer property set to true exceed the cache size, then images on lower layers are removed from the cache before images higher up the layers.

An image can be forced to be cached by using the prepare image command.

The image cache is keyed on the absolute filename of image thus it is highly efficient to use image objects referencing the same filename, rather than buttons referencing icons. In particular, there is only one decompressed set of image data for a given (absolute) filename in the cache at any one time.

The transformed image data of rotated and scaled images is cached, but images do not share this transformed data.

See also: imageCacheLimit (property),