DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

Berkeley DB Reference Guide:
Upgrading Berkeley DB Applications

PrevRefNext

Release 4.3: ENOMEM and DbMemoryException

In versions of Berkeley DB before 4.3, the error ENOMEM was used to indicate that the buffer in a DBT configured with DB_DBT_USERMEM was too small to hold a key or data item being retrieved. The 4.3 release adds a new error, DB_BUFFER_SMALL, that is returned in this case.

The reason for the change is that the use of ENOMEM was ambiguous: calls such as DB->get or DBcursor->c_get could return ENOMEM either if a DBT was too small or if some resource was exhausted.

The result is that starting with the 4.3 release, C applications should always treat ENOMEM as a fatal error. Code that checked for the ENOMEM return and allocated a new buffer should be changed to check for DB_BUFFER_SMALL.

In C++ applications configured for exceptions, a DbMemoryException will continue to be thrown in both cases, and applications should check the errno in the exception to determine which error occurred.

In Java applications, a DbMemoryException will be thrown when a Dbt is too small to hold a return value, and an OutOfMemoryError will be thrown in all cases of resource exhaustion.


PrevRefNext

Copyright (c) 1996-2005 Sleepycat Software, Inc. - All rights reserved.