<?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_sized_new">
  <info>
    <link type="guide" xref="bson_t" group="function"/>
  </info>
  <title>bson_sized_new()</title>

  <section id="synopsis">
    <title>Synopsis</title>
    <synopsis><code mime="text/x-csrc"><![CDATA[bson_t *
bson_sized_new (size_t size);
]]></code></synopsis>
  </section>

  <section id="parameters">
    <title>Parameters</title>
    <table>
      <tr><td><p>size</p></td><td><p>The size to pre-allocate for the underlying buffer.</p></td></tr>
    </table>
  </section>

  <section id="description">
    <title>Description</title>
    <p>The <code xref="bson_sized_new">bson_sized_new()</code> function shall create a new <code xref="bson_t">bson_t</code> on the heap with a preallocated buffer. This is useful if you have a good idea of the size of the resulting document.</p>
  </section>

  <section id="return">
    <title>Returns</title>
    <p>A newly allocated <code xref="bson_t">bson_t</code> that should be freed with <code xref="bson_destroy">bson_destroy()</code>.</p>
  </section>

</page>
