Creating a 'SIZE' Resource
When creating a 'SIZE' resource, you first need to determine the various
operating characteristics of your application. For example, if your application
has nothing useful to do when it is in the background, then you should not set
the canBackground flag. Similarly, if you have not tested your application in
an environment that uses all 32 bits of a handle or pointer for memory
addresses, then you should not set the is32BitCompatible flag.
Next, you need to determine what your application's memory requirements
are likely to be. There is no simple formula for determining the appropriate
partition size requirements for all applications because so many factors affect
memory requirements. An application's memory requirements depend on the
static heap size, the dynamic heap, the
A5 world, and the stack. The static heap size includes objects that are always
present during the execution of the application-for example, code segments,
PPC Toolbox data structures for window records, and so on. Dynamic heap requirements come from various objects created on a per-document basis
(which may vary in size proportionally with the document itself) and objects
that are required for specific commands or functions. The size of the A5 world
depends on the amount of global data and the number of intersegment jumps the
application contains. Finally, the stack contains variables, return addresses,
and temporary information. The application stack size varies among
computers, so you should base your values for the stack size according to the
automatically adjusts your requested amount of memory to compensate for the
different stack sizes on different machines. For example, if you request 512
KB, more stack space (approximately 16 KB) will be allocated on machines
with larger default stack sizes.
Unfortunately, it is simply impossible to forecast all of these conditions with
any great degree of reliability. You should be able to determine reasonably
accurate estimates for the stack size, static heap size, A5 world, and jump
table. In addition, you can use tools such as MacsBug's heap-exploring
commands to help you empirically determine your application's dynamic
memory requirements.