### Berkeley DB Reference Guide: Upgrading Berkeley DB Applications |

### Release 4.0: memp_XXX

The C API for the Berkeley DB Memory Pool subsystem was reworked in the 4.0 release as follows:

Historic functional interface | Berkeley DB 4.X method
--- | ---
memp_register | DB_ENV->memp_register
memp_stat | DB_ENV->memp_stat
memp_sync | DB_ENV->memp_sync
memp_trickle | DB_ENV->memp_trickle
memp_fopen | DB_ENV->memp_fcreate
DB_MPOOL_FINFO: ftype | DB_MPOOLFILE->set_ftype
DB_MPOOL_FINFO: pgcookie | DB_MPOOLFILE->set_pgcookie
DB_MPOOL_FINFO: fileid | DB_MPOOLFILE->set_fileid
DB_MPOOL_FINFO: lsn_offset | DB_MPOOLFILE->set_lsn_offset
DB_MPOOL_FINFO: clear_len | DB_MPOOLFILE->set_clear_len
memp_fopen | DB_MPOOLFILE->open
memp_fclose | DB_MPOOLFILE->close
memp_fput | DB_MPOOLFILE->put
memp_fset | DB_MPOOLFILE->set
memp_fsync | DB_MPOOLFILE->sync

Applications calling any of the memp_register, memp_stat, memp_sync or memp_trickle functions should update those calls to use the enclosing DB_ENV handle's method (easily done as the first argument to the existing call is the correct DB_ENV handle).

In addition, the DB_ENV->memp_stat call has been changed in the 4.0 release to take a flags argument. To leave their historic behavior unchanged, applications should add a final argument of 0 to any calls made to DB_ENV->memp_stat.

Applications calling the memp_fopen function should update those calls as follows: First, acquire a DB_MPOOLFILE handle using the DB_ENV->memp_fcreate method. Second, if the DB_MPOOL_FINFO structure reference passed to the memp_fopen function was non-NULL, call the DB_MPOOLFILE method corresponding to each initialized field in the DB_MPOOL_FINFO structure. Third, call the DB_MPOOLFILE->open method method to open the underlying file. If the DB_MPOOLFILE->open method call fails, then DB_MPOOLFILE->close method must be called to destroy the allocated handle.

Applications calling the memp_fopen, memp_fclose, memp_fput, memp_fset, or memp_fsync functions should update those calls to use the enclosing DB_MPOOLFILE handle's method. Again, this is easily done as the first argument to the existing call is the correct DB_MPOOLFILE handle. With one exception, the calling conventions of the old and new interfaces are identical; the one exception is the DB_MPOOLFILE->close method, which requires an additional flag parameter that should be set to 0.

Copyright (c) 1996-2006 Oracle Corporation - All rights reserved.