Using Record Stores Instead of Heap Memory

An additional opportunity for saving heap space is to store application data in a record store instead of consuming heap memory. The space available for persistent storage is often significantly larger than the heap memory, so in situations where heap memory is really rare, it may make sense to shift some of the memory consumption from the heap to persistent storage. However, accessing persistent storage may be significantly slower than heap access. Thus, the price for having more heap may be a significant performance tradeoff.

In order to demonstrate how to store objects in a record store instead of a Vector, let's create a sample implementation of a StringVectorRms class that stores a list of String ...

Get Java™ 2 Micro Edition Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.