Using Fixed-Object Allocators

The fastest class of memory allocation algorithm is the fixed-block allocator. It uses constant time for memory allocation and constant time to return memory to the free pool. Its only problem is that all of its allocations are the same size. If you use a fixed-block allocator in a language like C, you can choose a likely size (say, 50 bytes), create an allocator with a pool of 50-byte blocks, and use those blocks for any structure whose size is not greater than 50 bytes.

The Java programming language does not support the concept of blocks of memory. The Java equivalent of a fixed-block allocator is an allocator that controls a pool of preallocated objects.

Carrier Objects

The free pool for a fixed-block allocator ...

Get Real-Time Java™ Platform Programming 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.