JamaicaVM -- User Documentation: The Virtual Machine for Real-time and Embedded Systems | ||
---|---|---|
Prev | Chapter 3. Configuration of the Memory Management | Next |
The choice between dynamic and static mode strongly depends on the kind of application. If worst-case execution time is the only criteria, static mode will provide the same performance with smaller heap sizes. But if average case execution time is also an issue, dynamic mode will typically give better overall throughput, even though for equal heap size the guaranteed worst-case execution time is longer than in static mode.
Another point that might be important is gradual degradation. Dynamic and static mode differ significantly for the case that the application does not stay within its memory bounds that were fixed when the application was build.
The reasons for an application using more memory might be as follows:
The application might be used with input data that is bigger than anticipated originally.
The application was built with a wrong or outdated -heapSize argument.
A bug in the application might causes a memory leak and gradual use of more memory than expected.
Whatever the reason, in some environments it might be of importance to know the behaviour of the memory management in the case the application exceeds the assumed heap usage.
In dynamic mode, the worst-case execution time for an allocation cannot be guaranteed anymore as soon as the application uses more memory. But as long as the excess heap used stays small, the worst-case execution time will increase only slightly. This means that the original worst-case execution time might not be exceeded at all or might be exceeded by a small amount of time only. But the garbage collector will still work properly and recycle enough memory to keep the application running.
In static mode, the amount of garbage-collection work is not increased even if the application uses more memory than originally anticipated. This means, allocations will still give the same worst-case exection time guarantees. Instead, the collector cannot give a guarantee that it is recycling memory fast enough. This means, the application might abruptly fail with an out-of-memory error. Static mode does not provide graceful degradation of performance in this case, but might cause abrupt failure even if the application only slightly exceeds the expected memory requirements.