Sun Microsystems 2 Wireless Office Headset User Manual


 
Chapter 3 Managing Native Resources 25
behavior might be less confusing to the user than the failures that could happen
with the open resource policy, because these failures are predictable. They always
happen when the user tries to start the application.
The default policy is open for competition. To use a fixed-partition resource policy,
you must set a build-time flag USE_FIXED=true. See the Sun Java Wireless Client
Build Guide for more information.
Customization of Resource Allocation
Policies
Most implementations need to tailor resource allocation policies to each resource
instead of specifying a blanket open or fixed policy for all resources. For example, on
a particular platform, heap memory might be relatively plentiful, and so choosing a
fixed policy for memory might be appropriate to gain predictability, possibly at the
expense of some waste. However, another resource, such as network sockets, might
be too scarce to tolerate any waste, even at the cost of some unpredictability. An
open policy is more appropriate for these resources.
It is also possible to customize the reservations and limits to be somewhere between
the extremes specified by the fixed and open policies. For example, a particular
implementation might want to guarantee 250 kilobytes of heap memory for each
MIDlet, but it doesn’t necessarily want to constrain a large MIDlet from consuming
as much heap memory as it wants. In this case, specify a reservation of 250 kilobytes
and specify no limit on heap memory.
The resource allocation policies are specified in XML files in the following directories
in the source tree:
src/configuration/configuration_xml/platform
These directories contain several XML files that specify various constants used in for
all aspects of the system. For more information about these files and how to modify
constants, see the Managing Properties and Constants chapter of the Porting Guide.
The two XML files that specify the resource policies are constants_fixed.xml
and constants_open.xml. The constants_fixed.xml file is used if the build
flag USE_FIXED=true, otherwise the constants_open.xml file is used.
The best way to modify the resource allocation policy is to ensure that USE_FIXED=
false (which is the default) and to modify the constants_open.xml file. Some of
the constants in this file are described in
TABLE 3-1. To specify no reservation or limit,
use the value -1. For example, the default value of SUITE_MEMORY_LIMIT is -1,
which sets no limit on the amount of memory that a MIDlet suite can allocate.