<?xml version="1.0"?>
<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      style="function"
      xmlns:api="http://projectmallard.org/experimental/api/"
      xmlns:ui="http://projectmallard.org/experimental/ui/"
      id="bson_mem_set_vtable">
  <info>
    <link type="guide" xref="memory" group="function"/>
  </info>
  <title>bson_mem_set_table()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[typedef struct _bson_mem_vtable_t
{
   void *(*malloc)    (size_t  num_bytes);
   void *(*calloc)    (size_t  n_members,
                       size_t  num_bytes);
   void *(*realloc)   (void   *mem,
                       size_t  num_bytes);
   void  (*free)      (void   *mem);
   void *padding [4];
} bson_mem_vtable_t;

void bson_mem_set_vtable (const bson_mem_vtable_t *vtable);
]]></code></synopsis>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p><code>vtable</code></p></td><td><p>A bson_mem_vtable_t with every non-padding field set.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <title>Description</title>
    <p>This function shall install a new memory allocator to be used by Libbson.</p>
    <note style="critical"><p>This function <em>MUST</em> be called at the beginning of the process. Failure to do so will result in memory being freed by the wrong allocator.</p></note>
  </section>

</page>
