#include <db.h> int DB->set_heapsize(DB *db, u_int32_t gbytes, u_int32_t bytes, u_int32_t flags);
Sets the maximum on-disk database file size used by a database
configured to use the Heap access method. If this method is never
called, the database's file size can grow without bound. If this
method is called, then the heap file can never grow larger than the
limit defined by this method. In that case, attempts to update or
create records in a Heap database that has reached its maximum size
will result in a DB_HEAP_FULL
error return.
The size specified to this method must be at least three times the database page size. That is, a Heap database must contain at least three database pages. You can set the database page size using the DB->set_pagesize() method.
The DB->set_heapsize()
method may not be
called after the
DB->open()
method is called. Further, if this method is called on an existing
Heap database, the size specified here must match the size used to
create the database. Note, however, that specifying an incorrect
size to this method will not result in an error return
(EINVAL
) until the database is opened.
The DB->set_heapsize()
method returns a non-zero error value on failure and 0 on success.
The DB->set_heapsize()
method may fail and return one of the following non-zero errors:
If the specified heap size was too small; the method was called after DB->open() was called; or if an invalid flag value or parameter was specified.