<h2class="title"style="clear: both"><aid="am_misc_perm"></a>Retrieved key/data permanence for C/C++</h2>
</div>
</div>
</div>
<p>When using the non-cursor Berkeley DB calls to retrieve key/data items under
the C/C++ APIs (for example, <ahref="../api_reference/C/dbget.html"class="olink">DB->get()</a>), the memory to which the
pointer stored into the <ahref="../api_reference/C/dbt.html"class="olink">DBT</a> refers is only valid until the next
call to Berkeley DB using the <ahref="../api_reference/C/db.html"class="olink">DB</a> handle. (This includes <spanclass="bold"><strong>any</strong></span>
use of the returned <ahref="../api_reference/C/db.html"class="olink">DB</a> handle, including by another thread of
control within the process. For this reason, when multiple threads are
using the returned <ahref="../api_reference/C/db.html"class="olink">DB</a> handle concurrently, one of the
<ahref="../api_reference/C/dbt.html#dbt_DB_DBT_MALLOC"class="olink">DB_DBT_MALLOC</a>, <ahref="../api_reference/C/dbt.html#dbt_DB_DBT_REALLOC"class="olink">DB_DBT_REALLOC</a> or <ahref="../api_reference/C/dbt.html#dbt_DB_DBT_USERMEM"class="olink">DB_DBT_USERMEM</a>
flags must be specified with any non-cursor <ahref="../api_reference/C/dbt.html"class="olink">DBT</a> used for key or
data retrieval.)</p>
<p>When using the cursor Berkeley DB calls to retrieve key/data items under the
C/C++ APIs (for example, <ahref="../api_reference/C/dbcget.html"class="olink">DBC->get()</a>), the memory to which the
pointer stored into the <ahref="../api_reference/C/dbt.html"class="olink">DBT</a> refers is only valid until the next
call to Berkeley DB using the <ahref="../api_reference/C/dbc.html"class="olink">DBC</a> returned by <ahref="../api_reference/C/dbcursor.html"class="olink">DB->cursor()</a>.</p>