Introduction to the memory pool subsystem

    A memory pool is a memory cache shared among any number of threads of control. The DB_INIT_MPOOL flag to the method opens and optionally creates a memory pool. When that pool is no longer in use, it should be closed using the DB_ENV->close() method.

    There are additional configuration interfaces that apply when opening a new file in the memory pool:

    • The method specifies the number of bytes to clear when creating a new page in the memory pool.
    • The DB_MPOOLFILE->set_fileid() method specifies a unique ID associated with the file.
    • The method specifies the byte offset of each page’s log sequence number (DB_LSN) for the purposes of transaction checkpoints.
    • The method specifies an application provided argument for the purposes of page input and output processing.
    • It is possible to gradually flush buffers from the pool in order to maintain a consistent percentage of clean buffers in the pool using the DB_ENV->memp_trickle() method.
    • The utility uses the DB_ENV->memp_stat() method to display statistics about the efficiency of the pool.
    • All dirty pages in the pool may be flushed using the method. In addition, DB_ENV->memp_sync() takes an argument that is specific to database systems, and which allows the memory pool to be flushed up to a specified log sequence number ().
    • The entire pool may be discarded using the DB_ENV->remove() method.

    For more information on the memory pool subsystem methods, see the section in the Berkeley DB C API Reference Guide.