Memory Is Extremely Limited
Now that you have an idea of how the system hands events off to the application, it’s time to look at how memory is handled. To start off, it will help if you remember one crucial point: memory is an extremely limited resource on Palm OS devices. Because of this, Palm OS applications need to be written with careful attention to memory management.
To that end, let’s examine the memory architecture on Palm devices. RAM is divided into two areas: storage and dynamic (see Figure 4.5). The storage area of memory is managed by the Database Manager, which we discuss in Chapter 6. It is dynamic memory, which is handled by the Memory Manager, that we discuss here.

Figure 4-5. Memory map
The dynamic memory is used for Palm OS globals, Palm OS dynamic allocations, your application’s global variables (note that C statics are a form of globals), your application’s stack space, and any dynamic memory allocations you make. As you can see in Table 4.1, the size available depends on the operating system and on the amount of total memory on the device.
Table 4-1. Dynamic Memory Usage for Various Palm OS Configurations
|
System Resources |
OS 3.0 (>1 MB) |
OS 2.0 (1 MB; has TCP/IP) |
OS 2.0 (512 KB; no TCP/IP) |
|---|---|---|---|
|
System Globals |
6KB |
2.5KB |
2.5KB |
|
System dynamic allocation (TCP/IP, IRDA, etc.) |
50KB |
47KB |
15KB |
|
Application stack (call stack and local variables) |
(by default) |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access