<!--$Id: enomem.so,v 1.2 2004/09/28 14:13:09 bostic Exp $--> <!--Copyright (c) 1997,2008 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB Reference Guide: Release 4.3: ENOMEM and DbMemoryException</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <table width="100%"><tr valign=top> <td><b><dl><dt>Berkeley DB Reference Guide:<dd>Upgrading Berkeley DB Applications</dl></b></td> <td align=right><a href="../upgrade.4.3/fileopen.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../upgrade.4.3/repl.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p align=center><b>Release 4.3: ENOMEM and DbMemoryException</b></p> <p>In versions of Berkeley DB before 4.3, the error <b>ENOMEM</b> was used to indicate that the buffer in a <a href="../../api_c/dbt_class.html">DBT</a> configured with <a href="../../api_c/dbt_class.html#DB_DBT_USERMEM">DB_DBT_USERMEM</a> was too small to hold a key or data item being retrieved. The 4.3 release adds a new error, <a href="../../api_c/dbt_class.html#DB_BUFFER_SMALL">DB_BUFFER_SMALL</a>, that is returned in this case.</p> <p>The reason for the change is that the use of <b>ENOMEM</b> was ambiguous: calls such as <a href="../../api_c/db_get.html">DB->get</a> or <a href="../../api_c/dbc_get.html">DBcursor->get</a> could return <b>ENOMEM</b> either if a <a href="../../api_c/dbt_class.html">DBT</a> was too small or if some resource was exhausted.</p> <p>The result is that starting with the 4.3 release, C applications should always treat <b>ENOMEM</b> as a fatal error. Code that checked for the <b>ENOMEM</b> return and allocated a new buffer should be changed to check for <a href="../../api_c/dbt_class.html#DB_BUFFER_SMALL">DB_BUFFER_SMALL</a>.</p> <p>In C++ applications configured for exceptions, a <a href="../../api_cxx/memp_class.html">DbMemoryException</a> will continue to be thrown in both cases, and applications should check the errno in the exception to determine which error occurred.</p> <p>In Java applications, a <b>DbMemoryException</b> will be thrown when a <b>Dbt</b> is too small to hold a return value, and an <b>OutOfMemoryError</b> will be thrown in all cases of resource exhaustion.</p> <table width="100%"><tr><td><br></td><td align=right><a href="../upgrade.4.3/fileopen.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../upgrade.4.3/repl.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> </body> </html>