JamaicaVM -- User Documentation: The Virtual Machine for Real-time and Embedded Systems | ||
---|---|---|
Prev | Chapter 4. Configuration of the Memory Management | Next |
For applications that require best worst-case execution times, while average case execution time is less important, Jamaica also provides to statically select the amount of garbage collection work. This forces the given amount of garbage collection work to be performed at any allocation, not regarding the current state of the application. The advantage of this static mode is that worst-case execution times are lower than using dynamic determination of garbage collection work. The disadvantage is that any allocation requires this worst-case amount of garbage collection work.
The output generated by the application that was built using the option -analyse also shows possible values for the constant garbage collection work. In the example above, the constant garbage collection work varies from 3 to 80 units for heap sizes between 833k and 293k bytes. A unit of garbage collection work is the same as in the dynamic case, ie. about 160 machine instructions on the PowerPC processor.
Similarly, if we want to give the same guarantee of 14 units of work for the worst-case execution time of the allocation of a block of memory, a heap size of 325k bytes is sufficient. To inform the builder that constant garbage collection work should be used, the option -constGCwork and the number of units of work have to be specified when building the application:
> jamaica -heapSize=325k -constGCwork=14 -smart HelloWorld Jamaica Builder Tool 2.2 Release 1 Generating code for target 'linux-gnu-i686' + HelloWorld__.c * C compiling * linking * stripping Class file compaction gain: 95.85755% (1722798 ==> 71366) |