|
engine-mk1
|
The ObjectPool library is used store and access objects in contiguous aligned memory. Operations are performed throught the use of Handles.
The ObjectPool has several methods of adding objects, all of which return Handles which can be used to later access said objects.
Accessing the underlying memory pointers is done through Handles. As the ObjectPool doesn't store types, the desired objects type has to be supplied as a template argument (i.e. Data).
Destroying allocated objects is also done through Handles. In order for the ObjectPool to determine which underlying Pool the object is allocated in and call its destructor (for non-trivially destructable types), the objects type must be supplied as a template argument.
The ObjectPool supports automatic lifetime tracking through the use of std::shared_ptr and std::unique_ptr.
The ObjectPool can defragment itself in order to move disparate objects into the fewest contiguous memory regions possible. Pointers are invalidated by this process, however, handles are not.
The ObjectPool can remove any unused Pages in its underlying memory manager. This is useful when a large number of identically sized objects are bulk allocated then erased, which would leave some unused Pages behind.
The ObjectPool can query it's memory usage.
1.8.11