Skip to Main Content
Palm OS Programming, 2nd Edition
book

Palm OS Programming, 2nd Edition

by Julie McKeehan, Neil Rhodes
October 2001
Intermediate to advanced content levelIntermediate to advanced
704 pages
19h 33m
English
O'Reilly Media, Inc.
Content preview from Palm OS Programming, 2nd Edition

Stack Space

Prior to OS 3.0, the stack space was fixed at about 2.5 KB. For OS 3.0 and beyond, an application can provide a resource specifying a desired stack size. If no such resource is defined, the default stack size is 4 KB.

Keep in mind that stack space is used by all of the following:

  • Your application code directly

  • The OS, whenever you call an OS routine

  • Other applications when called by the OS (e.g., during a Find, a Beam Receive, or an Alarm)

For those launch codes where the OS provides a new stack to an application (like sysAppLaunchCmdNormalLaunch), it does so by allocating a nonrelocatable memory block, and setting up the processor’s stack pointer to the last byte of that memory block. On the processors currently used by the Palm OS, the stack grows down (as items are pushed on the stack, the stack pointer points to lower memory addresses).

In order to specify a stack size other than the default, you’ll need a `pref' resource, with ID 0. The resource consists of the following:

Priority

A 2-byte integer specifying the priority of this application. It is currently unused, but you should set it to 30.

stackSize

A 4-byte desired stack size (in bytes). The default, if you don’t provide a stack size is 0xD00 (3.25 KB) for OS 3.0 to OS 3.3, and 3.5 KB for OS 3.5 and OS 4.0.

minHeapSpace

A 4-byte minimum heap size necessary for this application to run. It is currently unused, but you should set it to 0x1000 (4 KB).

APIs

There is a single API that returns information about ...

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.
Start your free trial

You might also like

Palm OS Network Programming

Palm OS Network Programming

Greg Winton
Palm Programming: The Developer's Guide

Palm Programming: The Developer's Guide

Neil Rhodes, Julie McKeehan

Publisher Resources

ISBN: 1565928563Errata Page