|
-
February 10th, 2003, 12:50 AM
#1
memory compression
hi all,
i am downloading a program to a hardware device having limited memory.
is it possible to compress different parts of the program in the device and decompress it when it is to be used?
which algorithm shall i use?
thanx in advance
ratheeshravi
-
February 10th, 2003, 12:52 PM
#2
To do this, you need to be able to separate your code into chunks that have as little coupling as possible between them. You must then be able to have an encryption/decryption engine that operates on the chunks fit in the memory and develop the rules for encryption/decryption of chunks prior to calls from one chunk to another. This is difficult in standard c++ because the language does not have a notion of the size of functions, but is possible if the c++ works directly on the machine language memory area of the code using unsafe casts and builds function pointers. However, this is only a reasonable approach if the size of the encryption/decryption engine + a decompression buffer do not make the excutable larger than the compressed version.
The proper compression algorithm depends on the instruction set of the processor you are targetting. If it is a small, fixed (N) bit instruction set, then an N-bit huffman compression could be proper (or at least compression on the operand bit size if the data bit size is a multiple).
Also note that such techniques decrease the performance of the program, which is often not acceptable for embedded devices.
*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/
"It's hard to believe in something you don't understand." -- the sidhi X-files episode
galathaea: prankster, fablist, magician, liar
-
February 10th, 2003, 06:29 PM
#3
If you are using WinCE or something similar, you can write most of your code in a .dll and decompress it before you dynamically load it. It is fairly simple to do.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|