1. Field of the Invention
The invention relates in general to a memory technique, and more particularly to a technique for saving memory space.
2. Description of the Related Art
Code and data that are no longer to be modified after electronic products are shipped out of the factory are generally recorded in a read-only memory (ROM). In the recently years, one development trend for consumer electronic products has been to integrate various functions into a single product. For example, portable handsets are designed to support extra functions such as a camera and Internet browsing in addition to basic telephone functions. Diversified functions lead to large and complex coding. To store a greater amount of code and data, the capacity of a ROM built into an electronic product is inevitably and correspondingly enlarged, leading to increased hardware costs.
In response to the above issue, a current solution is to burn compressed code and data into a ROM. Taking an example of compressing a code of an application and burning the compressed code into a ROM, an electronic device first fetches the compressed code from the ROM, and then decompresses the code through a decompressor to a random access memory (RAM) for the use of a corresponding processor.
In the prior art, an application is utilized as a unit of compression/decompression. In other words, when a certain application is needed, an electronic device is required to decompress all code of the desired application to a RAM in order to utilize the application. However, the above approach suffers from a drawback that the RAM must have a large capacity for accommodating all kinds of decompressed code. Thus, hardware costs of an electronic product are again increased due to a costly RAM.