Skip to content

TNonFreePooledMemManager

Memory manager for fixed memory blocks which does not free any memory.

Declaration

Source position: pooledmm.pp line 80

type

  TNonFreePooledMemManager = class
  public
    ClearOnCreate: Boolean;
    property ItemSize: Integer; {r}
    procedure Clear;
    constructor Create;
    destructor Destroy;
    function NewItem : Pointer;
    procedure EnumerateItems;
  end;

Description

TNonFreePooledMemManager keeps a list of fixed-size memory blocks in memory. Each block has the same size, making it suitable for storing a lot of records of the same type. It does not free the items stored in it, except when the list is cleared as a whole.

It allocates memory for the blocks in a exponential way, i.e. each time a new block of memory must be allocated, it's size is the double of the last block. The first block will contain 8 items.

Properties

Member Visibility Description
ItemSize read only public Size of an item in the list.

Methods

Member Visibility Description
Clear public Clears the memory.
Create public Creates a new instance of TNonFreePooledMemManager.
Destroy public Removes the TNonFreePooledMemManager instance from memory.
EnumerateItems public Enumerate all items in the list.
NewItem public Return a pointer to a new memory block.

Fieldss

Member Visibility Description
ClearOnCreate public Determines whether newly allocated memory should be cleared.