Poco::FastMemoryPool

class Block

Library: Foundation
Package: Core
Header: Poco/MemoryPool.h

Description

A block of memory. This class represents a memory block. It has dual use, the primary one being obvious - memory provided to the user of the pool. The secondary use is for internal "housekeeping" purposes.

It works like this:

  • when initially created, a Block is properly constructed and positioned into the internal linked list of blocks

  • when given to the user, the Block is removed from the internal linked list of blocks

  • when returned back to the pool, the Block is again in-place constructed and inserted as next available block in the linked list of blocks

Constructors

Block inline

Block();

Creates a Block and sets its next pointer. This constructor should ony be used to initialize a block sequence (an array of blocks) in a newly allocated bucket.

After the construction, the last block's next pointer points outside the allocated memory and must be set to zero. This design improves performance, because otherwise the block array would require an initialization loop after the allocation.

Block inline

explicit Block(
    Block * next
);

Creates a Block and sets its next pointer.