How the STB allocates memory
Memory on the STB is allocated from a number of different memory regions/areas. Each area is independent and can be used only for the memory uses it has been assigned to support. You can run out of memory in one area but still have free memory in a different area.
For example, a site could display a memory error message in the debug window due to a large amount of JavaScript processing but still have spare memory for images. Unfortunately, the Liberate 1.1 client does not supply memory usage information.
Reducing Code Memory Usage
- Try to reduce the number of script tags used on a page, as each use of the <script> tags in a web page uses additional large amount of memory (48k per tag)
- Where pages in a frameset use common code, place this code in a javascript include file. e.g. <script src="common.js"></script>
- Avoid placing all of a sites Javascript into one large javascript include file. Split the Javascript into small, related parts, each in a separate include file. Within each page, only refer to those JavaScript includes that are used by that page. This avoids unused code taking up space in memory.
- Make use of functions instead of repeating common code.
Reducing Data Object Size
- Liberate creates & stores data objects in memory but this memory is not recovered immediately when an item is no longer in use. So try not to repeatedly create and delete objects as this can cause memory errors.
- Identical strings (or strings with same value) are only stored in the STB memory ONCE no matter how many times the code refers to them.