The static data block is a block of memory that Windows CE loads with an application. This block contains strings, buffers, and other static values that the application references throughout the life of the application. Windows CE allocates two sections for static data: one for read/write data and one for read-only data. Because Windows CE allocates the static data blocks one page at a time, you can often find unused memory between the end of the static data and the end of the memory page. Use a utility such as DumpBin.exe, or the Remote Memory viewer, to determine the size of your application's static data block. Use this information to arrange your declared data as efficiently as possible.
One way to use the unused memory in the static data blocks is to assign the unused memory to a buffer. Use this buffer in your application instead of creating a buffer dynamically. When assigning extra memory to a buffer, be sure to leave at least 64 KB free for the loader. Windows CE allocates another page for the loader if it cannot find enough space in the current static data page.
Another technique is to place a note in your code to remind you to look at your memory use each time that you add more data. For example, Windows CE might assign an entire memory page to your application when you only need room for a single variable. By modifying your application, you can save this page and thus lower your memory requirements.
You can also reduce the size of your data blocks by declaring data in the read/write sections as "const." Windows CE then moves all "const" data to the read-only section. Windows CE places all constant data items in the read-only data block instead of in the read/write data block. However, if declaring all of your constant data forces Windows CE to allocate another page, you can move some of that data into the read/write block.