libdb/docs/upgrading/upgrade_4_3_enomem.html
2011-09-13 13:44:24 -04:00

80 lines
4.4 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ENOMEM and DbMemoryException</title>
<link rel="stylesheet" href="gettingStarted.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
<link rel="start" href="index.html" title="Berkeley DB Upgrade Guide" />
<link rel="up" href="upgrade_4_3_toc.html" title="Chapter 7. Upgrading Berkeley DB 4.2 applications to Berkeley DB 4.3" />
<link rel="prev" href="upgrade_4_3_fileopen.html" title="DB_FILEOPEN" />
<link rel="next" href="upgrade_4_3_repl.html" title="Replication" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 11.2.5.2</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">ENOMEM and DbMemoryException</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="upgrade_4_3_fileopen.html">Prev</a> </td>
<th width="60%" align="center">Chapter 7. Upgrading Berkeley DB 4.2 applications to Berkeley DB 4.3</th>
<td width="20%" align="right"> <a accesskey="n" href="upgrade_4_3_repl.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="upgrade_4_3_enomem"></a>ENOMEM and DbMemoryException</h2>
</div>
</div>
</div>
<p>In versions of Berkeley DB before 4.3, the error <span class="bold"><strong>ENOMEM</strong></span> was used to
indicate that the buffer in a <a href="../api_reference/C/dbt.html" class="olink">DBT</a> configured with
<a href="../api_reference/C/dbt.html#dbt_DB_DBT_USERMEM" class="olink">DB_DBT_USERMEM</a> was too small to hold a key or data item being
retrieved. The 4.3 release adds a new error, <code class="literal">DB_BUFFER_SMALL</code>,
that is returned in this case.</p>
<p>The reason for the change is that the use of <span class="bold"><strong>ENOMEM</strong></span> was
ambiguous: calls such as <a href="../api_reference/C/dbget.html" class="olink">DB-&gt;get()</a> or <a href="../api_reference/C/dbcget.html" class="olink">DBC-&gt;get()</a> could return
<span class="bold"><strong>ENOMEM</strong></span> either if a <a href="../api_reference/C/dbt.html" class="olink">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 <span class="bold"><strong>ENOMEM</strong></span> as a fatal error. Code that checked for
the <span class="bold"><strong>ENOMEM</strong></span> return and allocated a new buffer should be changed
to check for <code class="literal">DB_BUFFER_SMALL</code>.</p>
<p>
In C++ applications configured for exceptions, a
<a href="../api_reference/CXX/dbmemory.html" class="olink">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 <span class="bold"><strong>DbMemoryException</strong></span> will be thrown when a <span class="bold"><strong>Dbt</strong></span> is too small to hold a return value, and an <span class="bold"><strong>OutOfMemoryError</strong></span> will be thrown in all cases of resource exhaustion.</p>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="upgrade_4_3_fileopen.html">Prev</a> </td>
<td width="20%" align="center">
<a accesskey="u" href="upgrade_4_3_toc.html">Up</a>
</td>
<td width="40%" align="right"> <a accesskey="n" href="upgrade_4_3_repl.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">DB_FILEOPEN </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> Replication</td>
</tr>
</table>
</div>
</body>
</html>