<divclass="textblock"><p>Checkout the sources from Github: </p><divclass="fragment"><divclass="line">git clone https:<spanclass="comment">//github.com/microsoft/mimalloc</span></div></div><!-- fragment --><h2>Windows</h2>
<p>Open <code>ide/vs2019/mimalloc.sln</code> in Visual Studio 2019 and build (or <code>ide/vs2017/mimalloc.sln</code>). The <code>mimalloc</code> project builds a static library (in <code>out/msvc-x64</code>), while the <code>mimalloc-override</code> project builds a DLL for overriding malloc in the entire program.</p>
<p>We use <ahref="https://cmake.org"><code>cmake</code></a><sup>1</sup> as the build system:</p>
<divclass="fragment"><divclass="line">> mkdir -p out/release</div><divclass="line">> cd out/release</div><divclass="line">> cmake ../..</div><divclass="line">> make</div></div><!-- fragment --><p> This builds the library as a shared (dynamic) library (<code>.so</code> or <code>.dylib</code>), a static library (<code>.a</code>), and as a single object file (<code>.o</code>).</p>
<p><code>> sudo make install</code> (install the library and header files in <code>/usr/local/lib</code> and <code>/usr/local/include</code>)</p>
<p>You can build the debug version which does many internal checks and maintains detailed statistics as:</p>
<divclass="fragment"><divclass="line">> mkdir -p out/debug</div><divclass="line">> cd out/debug</div><divclass="line">> cmake -DCMAKE_BUILD_TYPE=Debug ../..</div><divclass="line">> make</div></div><!-- fragment --><p> This will name the shared library as <code>libmimalloc-debug.so</code>.</p>
<p>Finally, you can build a <em>secure</em> version that uses guard pages, encrypted free lists, etc, as: </p><divclass="fragment"><divclass="line">> mkdir -p out/secure</div><divclass="line">> cd out/secure</div><divclass="line">> cmake -DMI_SECURE=ON ../..</div><divclass="line">> make</div></div><!-- fragment --><p> This will name the shared library as <code>libmimalloc-secure.so</code>. Use <code>ccmake</code><sup>2</sup> instead of <code>cmake</code> to see and customize all the available build options.</p>