diff --git a/doc/mimalloc-doc.h b/doc/mimalloc-doc.h index e2287fe9..4cf8c2c3 100644 --- a/doc/mimalloc-doc.h +++ b/doc/mimalloc-doc.h @@ -51,7 +51,7 @@ Notable aspects of the design include: programs. - __secure__: _mimalloc_ can be build in secure mode, adding guard pages, randomized allocation, encrypted free lists, etc. to protect against various - heap vulnerabilities. The performance penalty is only around 3% on average + heap vulnerabilities. The performance penalty is only around 5% on average over our benchmarks. - __first-class heaps__: efficiently create and use multiple heaps to allocate across different regions. A heap can be destroyed at once instead of deallocating each object separately. @@ -413,6 +413,28 @@ void mi_register_error(mi_error_fun* errfun, void* arg); /// This function is relatively fast. bool mi_is_in_heap_region(const void* p); +/// Reserve OS memory for use by mimalloc. Reserved areas are used +/// before allocating from the OS again. By reserving a large area upfront, +/// allocation can be more efficient, and can be better managed on systems +/// without `mmap`/`VirtualAlloc` (like WASM for example). +/// @param size The size to reserve. +/// @param commit Commit the memory upfront. +/// @param allow_large Allow large OS pages (2MiB) to be used? +/// @return \a 0 if successful, and an error code otherwise (e.g. `ENOMEM`). +int mi_reserve_os_memory(size_t size, bool commit, bool allow_large); + +/// Manage a particular memory area for use by mimalloc. +/// This is just like `mi_reserve_os_memory` except that the area should already be +/// allocated in some manner and available for use my mimalloc. +/// @param start Start of the memory area +/// @param size The size of the memory area. +/// @param commit Is the area already committed? +/// @param is_large Does it consist of large OS pages? Set this to \a true as well for memory +/// that should not be decommitted or protected (like rdma etc.) +/// @param is_zero Does the area consists of zero's? +/// @param numa_node Possible associated numa node or `-1`. +/// @return \a true if successful, and \a false on error. +bool mi_manage_os_memory(void* start, size_t size, bool is_committed, bool is_large, bool is_zero, int numa_node); /// Reserve \a pages of huge OS pages (1GiB) evenly divided over \a numa_nodes nodes, /// but stops after at most `timeout_msecs` seconds. @@ -476,9 +498,12 @@ void mi_process_info(size_t* elapsed_msecs, size_t* user_msecs, size_t* system_m /// /// \{ +/// The maximum supported alignment size (currently 1MiB). +#define MI_ALIGNMENT_MAX (1024*1024UL) + /// Allocate \a size bytes aligned by \a alignment. /// @param size number of bytes to allocate. -/// @param alignment the minimal alignment of the allocated memory. +/// @param alignment the minimal alignment of the allocated memory. Must be less than #MI_ALIGNMENT_MAX. /// @returns pointer to the allocated memory or \a NULL if out of memory. /// The returned pointer is aligned by \a alignment, i.e. /// `(uintptr_t)p % alignment == 0`. @@ -829,8 +854,14 @@ void* mi_valloc(size_t size); void* mi_pvalloc(size_t size); void* mi_aligned_alloc(size_t alignment, size_t size); + +/// Correspond s to [reallocarray](https://www.freebsd.org/cgi/man.cgi?query=reallocarray&sektion=3&manpath=freebsd-release-ports) +/// in FreeBSD. void* mi_reallocarray(void* p, size_t count, size_t size); +/// Corresponds to [reallocarr](https://man.netbsd.org/reallocarr.3) in NetBSD. +int mi_reallocarr(void* p, size_t count, size_t size); + void mi_free_size(void* p, size_t size); void mi_free_size_aligned(void* p, size_t size, size_t alignment); void mi_free_aligned(void* p, size_t alignment); @@ -1161,6 +1192,12 @@ void* calloc(size_t size, size_t n); void* realloc(void* p, size_t newsize); void free(void* p); +void* aligned_alloc(size_t alignment, size_t size); +char* strdup(const char* s); +char* strndup(const char* s, size_t n); +char* realpath(const char* fname, char* resolved_name); + + // C++ void operator delete(void* p); void operator delete[](void* p); @@ -1180,16 +1217,24 @@ int posix_memalign(void** p, size_t alignment, size_t size); // Linux void* memalign(size_t alignment, size_t size); -void* aligned_alloc(size_t alignment, size_t size); void* valloc(size_t size); void* pvalloc(size_t size); size_t malloc_usable_size(void *p); +void* reallocf(void* p, size_t newsize); + +// macOS +void vfree(void* p); +size_t malloc_size(const void* p); +size_t malloc_good_size(size_t size); // BSD void* reallocarray( void* p, size_t count, size_t size ); void* reallocf(void* p, size_t newsize); void cfree(void* p); +// NetBSD +int reallocarr(void* p, size_t count, size_t size); + // Windows void* _expand(void* p, size_t newsize); size_t _msize(void* p); diff --git a/docs/annotated.html b/docs/annotated.html index feba2438..f3e392a4 100644 --- a/docs/annotated.html +++ b/docs/annotated.html @@ -3,7 +3,7 @@ - + mi-malloc: Data Structures @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
mi-malloc -  1.6 +  1.7/2.0
- @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
@@ -60,10 +56,10 @@ - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
@@ -113,9 +109,7 @@ $(document).ready(function(){initNavTree('annotated.html','');}); diff --git a/docs/bench.html b/docs/bench.html index f39fade6..6c472895 100644 --- a/docs/bench.html +++ b/docs/bench.html @@ -3,7 +3,7 @@ - + mi-malloc: Performance @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
mi-malloc -  1.6 +  1.7/2.0
- @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
@@ -60,10 +56,10 @@
- + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
@@ -103,17 +99,15 @@ $(document).ready(function(){initNavTree('bench.html','');});

We tested mimalloc against many other top allocators over a wide range of benchmarks, ranging from various real world programs to synthetic benchmarks that see how the allocator behaves under more extreme circumstances.

-

In our benchmarks, mimalloc always outperforms all other leading allocators (jemalloc, tcmalloc, Hoard, etc) (Apr 2019), and usually uses less memory (up to 25% more in the worst case). A nice property is that it does consistently well over the wide range of benchmarks.

+

In our benchmarks, mimalloc always outperforms all other leading allocators (jemalloc, tcmalloc, Hoard, etc) (Jan 2021), and usually uses less memory (up to 25% more in the worst case). A nice property is that it does consistently well over the wide range of benchmarks.

See the Performance section in the mimalloc repository for benchmark results, or the the technical report for detailed benchmark results.

-
- + + diff --git a/docs/build.html b/docs/build.html index 2bd06f13..dbcc0d75 100644 --- a/docs/build.html +++ b/docs/build.html @@ -3,7 +3,7 @@ - + mi-malloc: Building @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
mi-malloc -  1.6 +  1.7/2.0
- @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
@@ -60,10 +56,10 @@ - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
@@ -102,28 +98,39 @@ $(document).ready(function(){initNavTree('build.html','');});
Building
-

Checkout the sources from Github:

git clone https://github.com/microsoft/mimalloc

Windows

+

Checkout the sources from Github:

git clone https://github.com/microsoft/mimalloc
+

Windows

Open ide/vs2019/mimalloc.sln in Visual Studio 2019 and build (or ide/vs2017/mimalloc.sln). The mimalloc project builds a static library (in out/msvc-x64), while the mimalloc-override project builds a DLL for overriding malloc in the entire program.

macOS, Linux, BSD, etc.

We use cmake1 as the build system:

-
> mkdir -p out/release
> cd out/release
> cmake ../..
> make

This builds the library as a shared (dynamic) library (.so or .dylib), a static library (.a), and as a single object file (.o).

+
> mkdir -p out/release
+
> cd out/release
+
> cmake ../..
+
> make
+

This builds the library as a shared (dynamic) library (.so or .dylib), a static library (.a), and as a single object file (.o).

> sudo make install (install the library and header files in /usr/local/lib and /usr/local/include)

You can build the debug version which does many internal checks and maintains detailed statistics as:

-
> mkdir -p out/debug
> cd out/debug
> cmake -DCMAKE_BUILD_TYPE=Debug ../..
> make

This will name the shared library as libmimalloc-debug.so.

-

Finally, you can build a secure version that uses guard pages, encrypted free lists, etc, as:

> mkdir -p out/secure
> cd out/secure
> cmake -DMI_SECURE=ON ../..
> make

This will name the shared library as libmimalloc-secure.so. Use ccmake2 instead of cmake to see and customize all the available build options.

+
> mkdir -p out/debug
+
> cd out/debug
+
> cmake -DCMAKE_BUILD_TYPE=Debug ../..
+
> make
+

This will name the shared library as libmimalloc-debug.so.

+

Finally, you can build a secure version that uses guard pages, encrypted free lists, etc, as:

> mkdir -p out/secure
+
> cd out/secure
+
> cmake -DMI_SECURE=ON ../..
+
> make
+

This will name the shared library as libmimalloc-secure.so. Use ccmake2 instead of cmake to see and customize all the available build options.

Notes:

  1. Install CMake: sudo apt-get install cmake
  2. Install CCMake: sudo apt-get install cmake-curses-gui
-
-
+ + diff --git a/docs/classes.html b/docs/classes.html index e74a0a24..b744c4d9 100644 --- a/docs/classes.html +++ b/docs/classes.html @@ -3,7 +3,7 @@ - + mi-malloc: Data Structure Index @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
mi-malloc -  1.6 +  1.7/2.0
- @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
@@ -60,10 +56,10 @@ - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
@@ -102,23 +98,18 @@ $(document).ready(function(){initNavTree('classes.html','');});
Data Structure Index
-
m
- - - - - -
  m  
-
mi_stl_allocator   
mi_heap_area_t   
-
m
+
M
+
+
+
M
+
mi_heap_area_t
mi_stl_allocator
+
diff --git a/docs/doxygen.css b/docs/doxygen.css index 72384716..f090ef79 100644 --- a/docs/doxygen.css +++ b/docs/doxygen.css @@ -1,4 +1,4 @@ -/* The standard CSS for doxygen 1.8.15 */ +/* The standard CSS for doxygen 1.9.1 */ body, table, div, p, dl { font: 400 14px/22px Roboto,sans-serif; @@ -53,17 +53,24 @@ dt { font-weight: bold; } -div.multicol { +ul.multicol { -moz-column-gap: 1em; -webkit-column-gap: 1em; + column-gap: 1em; -moz-column-count: 3; -webkit-column-count: 3; + column-count: 3; } p.startli, p.startdd { margin-top: 2px; } +th p.starttd, th p.intertd, th p.endtd { + font-size: 100%; + font-weight: 700; +} + p.starttd { margin-top: 0px; } @@ -96,30 +103,96 @@ caption { } span.legend { - font-size: 70%; - text-align: center; -} - -h3.version { - font-size: 90%; - text-align: center; -} - -div.qindex, div.navtab{ - background-color: #D6D9D9; - border: 1px solid #636C6D; + font-size: 70%; text-align: center; } -div.qindex, div.navpath { - width: 100%; - line-height: 140%; +h3.version { + font-size: 90%; + text-align: center; } div.navtab { - margin-right: 15px; + border-right: 1px solid #636C6D; + padding-right: 15px; + text-align: right; + line-height: 110%; } +div.navtab table { + border-spacing: 0; +} + +td.navtab { + padding-right: 6px; + padding-left: 6px; +} +td.navtabHL { + background-image: url('tab_a.png'); + background-repeat:repeat-x; + padding-right: 6px; + padding-left: 6px; +} + +td.navtabHL a, td.navtabHL a:visited { + color: #fff; + text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); +} + +a.navtab { + font-weight: bold; +} + +div.qindex{ + text-align: center; + width: 100%; + line-height: 140%; + font-size: 130%; + color: #A0A0A0; +} + +dt.alphachar{ + font-size: 180%; + font-weight: bold; +} + +.alphachar a{ + color: black; +} + +.alphachar a:hover, .alphachar a:visited{ + text-decoration: none; +} + +.classindex dl { + padding: 25px; + column-count:1 +} + +.classindex dd { + display:inline-block; + margin-left: 50px; + width: 90%; + line-height: 1.15em; +} + +.classindex dl.odd { + background-color: #F0F1F1; +} + +@media(min-width: 1120px) { + .classindex dl { + column-count:2 + } +} + +@media(min-width: 1320px) { + .classindex dl { + column-count:3 + } +} + + /* @group Link Styling */ a { @@ -136,17 +209,6 @@ a:hover { text-decoration: underline; } -a.qindex { - font-weight: bold; -} - -a.qindexHL { - font-weight: bold; - background-color: #5B6364; - color: #FFFFFF; - border: 1px double #464C4D; -} - .contents a.qindexHL:visited { color: #FFFFFF; } @@ -533,7 +595,7 @@ table.memberdecls { white-space: nowrap; } -.memItemRight { +.memItemRight, .memTemplItemRight { width: 100%; } @@ -701,7 +763,7 @@ dl.reflist dd { padding-left: 0px; } -.params .paramname, .retval .paramname, .tparams .paramname { +.params .paramname, .retval .paramname, .tparams .paramname, .exception .paramname { font-weight: bold; vertical-align: top; } @@ -1351,10 +1413,12 @@ dl.citelist dt { font-weight:bold; margin-right:10px; padding:5px; + text-align:right; + width:52px; } dl.citelist dd { - margin:2px 0; + margin:2px 0 2px 72px; padding:5px 0; } @@ -1417,6 +1481,12 @@ div.toc li.level4 { margin-left: 45px; } +span.emoji { + /* font family used at the site: https://unicode.org/emoji/charts/full-emoji-list.html + * font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", Times, Symbola, Aegyptus, Code2000, Code2001, Code2002, Musica, serif, LastResort; + */ +} + .PageDocRTL-title div.toc li.level1 { margin-left: 0 !important; margin-right: 0; @@ -1654,47 +1724,6 @@ tr.heading h2 { /* @group Markdown */ -/* -table.markdownTable { - border-collapse:collapse; - margin-top: 4px; - margin-bottom: 4px; -} - -table.markdownTable td, table.markdownTable th { - border: 1px solid #060606; - padding: 3px 7px 2px; -} - -table.markdownTableHead tr { -} - -table.markdownTableBodyLeft td, table.markdownTable th { - border: 1px solid #060606; - padding: 3px 7px 2px; -} - -th.markdownTableHeadLeft th.markdownTableHeadRight th.markdownTableHeadCenter th.markdownTableHeadNone { - background-color: #0B0C0C; - color: #FFFFFF; - font-size: 110%; - padding-bottom: 4px; - padding-top: 5px; -} - -th.markdownTableHeadLeft { - text-align: left -} - -th.markdownTableHeadRight { - text-align: right -} - -th.markdownTableHeadCenter { - text-align: center -} -*/ - table.markdownTable { border-collapse:collapse; margin-top: 4px; diff --git a/docs/dynsections.js b/docs/dynsections.js index ea0a7b39..3174bd7b 100644 --- a/docs/dynsections.js +++ b/docs/dynsections.js @@ -1,25 +1,26 @@ /* - @licstart The following is the entire license notice for the - JavaScript code in this file. + @licstart The following is the entire license notice for the JavaScript code in this file. - Copyright (C) 1997-2017 by Dimitri van Heesch + The MIT License (MIT) - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. + Copyright (C) 1997-2020 by Dimitri van Heesch - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. - @licend The above is the entire license notice - for the JavaScript code in this file + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file */ function toggleVisibility(linkObj) { diff --git a/docs/environment.html b/docs/environment.html index 87d67e4a..f571f95f 100644 --- a/docs/environment.html +++ b/docs/environment.html @@ -3,7 +3,7 @@ - + mi-malloc: Environment Options @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
mi-malloc -  1.6 +  1.7/2.0
- @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
@@ -60,10 +56,10 @@ - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
@@ -110,17 +106,16 @@ $(document).ready(function(){initNavTree('environment.html','');});
  • MIMALLOC_PAGE_RESET=0: by default, mimalloc will reset (or purge) OS pages when not in use to signal to the OS that the underlying physical memory can be reused. This can reduce memory fragmentation in long running (server) programs. By setting it to 0 no such page resets will be done which can improve performance for programs that are not long running. As an alternative, the MIMALLOC_RESET_DELAY=<msecs> can be set higher (100ms by default) to make the page reset occur less frequently instead of turning it off completely.
  • MIMALLOC_LARGE_OS_PAGES=1: use large OS pages (2MiB) when available; for some workloads this can significantly improve performance. Use MIMALLOC_VERBOSE to check if the large OS pages are enabled – usually one needs to explicitly allow large OS pages (as on Windows and Linux). However, sometimes the OS is very slow to reserve contiguous physical memory for large OS pages so use with care on systems that can have fragmented memory (for that reason, we generally recommend to use MIMALLOC_RESERVE_HUGE_OS_PAGES instead when possible).
  • MIMALLOC_RESERVE_HUGE_OS_PAGES=N: where N is the number of 1GiB huge OS pages. This reserves the huge pages at startup and sometimes this can give a large (latency) performance improvement on big workloads. Usually it is better to not use MIMALLOC_LARGE_OS_PAGES in combination with this setting. Just like large OS pages, use with care as reserving contiguous physical memory can take a long time when memory is fragmented (but reserving the huge pages is done at startup only once). Note that we usually need to explicitly enable huge OS pages (as on Windows and Linux)). With huge OS pages, it may be beneficial to set the setting MIMALLOC_EAGER_COMMIT_DELAY=N (N is 1 by default) to delay the initial N segments (of 4MiB) of a thread to not allocate in the huge OS pages; this prevents threads that are short lived and allocate just a little to take up space in the huge OS page area (which cannot be reset).
  • +
  • MIMALLOC_RESERVE_HUGE_OS_PAGES_AT=N: where N is the numa node. This reserves the huge pages at a specific numa node. (N is -1 by default to reserve huge pages evenly among the given number of numa nodes (or use the available ones as detected))
  • Use caution when using fork in combination with either large or huge OS pages: on a fork, the OS uses copy-on-write for all pages in the original process including the huge OS pages. When any memory is now written in that area, the OS will copy the entire 1GiB huge page (or 2MiB large page) which can cause the memory usage to grow in big increments.

    -
    - + + diff --git a/docs/functions.html b/docs/functions.html index 62021210..373fafe2 100644 --- a/docs/functions.html +++ b/docs/functions.html @@ -3,7 +3,7 @@ - + mi-malloc: Data Fields @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@ - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -120,9 +116,7 @@ $(document).ready(function(){initNavTree('functions.html','');}); diff --git a/docs/functions_vars.html b/docs/functions_vars.html index 7d41d10e..a12ef622 100644 --- a/docs/functions_vars.html +++ b/docs/functions_vars.html @@ -3,7 +3,7 @@ - + mi-malloc: Data Fields - Variables @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@
    - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -120,9 +116,7 @@ $(document).ready(function(){initNavTree('functions_vars.html','');}); diff --git a/docs/group__aligned.html b/docs/group__aligned.html index a3eaacf0..bd11f30f 100644 --- a/docs/group__aligned.html +++ b/docs/group__aligned.html @@ -3,7 +3,7 @@ - + mi-malloc: Aligned Allocation @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@
    - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -99,6 +95,7 @@ $(document).ready(function(){initNavTree('group__aligned.html','');});
    Aligned Allocation
    @@ -108,10 +105,16 @@ $(document).ready(function(){initNavTree('group__aligned.html','');});

    Allocating aligned memory blocks. More...

    + + + + +

    +Macros

    #define MI_ALIGNMENT_MAX
     The maximum supported alignment size (currently 1MiB). More...
     
    - + @@ -120,7 +123,7 @@ Functions - + @@ -131,6 +134,23 @@ Functions

    Functions

    void * mi_malloc_aligned (size_t size, size_t alignment)
     Allocate size bytes aligned by alignment. More...
     Allocate size bytes aligned by alignment. More...
     
    void * mi_zalloc_aligned (size_t size, size_t alignment)
     
    void * mi_realloc_aligned (void *p, size_t newsize, size_t alignment)
     
    void * mi_malloc_aligned_at (size_t size, size_t alignment, size_t offset)
     Allocate size bytes aligned by alignment at a specified offset. More...
     Allocate size bytes aligned by alignment at a specified offset. More...
     
    void * mi_zalloc_aligned_at (size_t size, size_t alignment, size_t offset)
     

    Detailed Description

    Allocating aligned memory blocks.

    +

    Macro Definition Documentation

    + +

    ◆ MI_ALIGNMENT_MAX

    + +
    +
    + + + + +
    #define MI_ALIGNMENT_MAX
    +
    + +

    The maximum supported alignment size (currently 1MiB).

    + +
    +

    Function Documentation

    ◆ mi_calloc_aligned()

    @@ -236,7 +256,7 @@ Functions
    Parameters
    - +
    sizenumber of bytes to allocate.
    alignmentthe minimal alignment of the allocated memory.
    alignmentthe minimal alignment of the allocated memory. Must be less than MI_ALIGNMENT_MAX.
    @@ -438,9 +458,7 @@ Functions diff --git a/docs/group__aligned.js b/docs/group__aligned.js index 0a5aa5c8..06ccb0c3 100644 --- a/docs/group__aligned.js +++ b/docs/group__aligned.js @@ -1,5 +1,6 @@ var group__aligned = [ + [ "MI_ALIGNMENT_MAX", "group__aligned.html#ga83c03016066b438f51a8095e9140be06", null ], [ "mi_calloc_aligned", "group__aligned.html#ga53dddb4724042a90315b94bc268fb4c9", null ], [ "mi_calloc_aligned_at", "group__aligned.html#ga08647c4593f3b2eef24a919a73eba3a3", null ], [ "mi_malloc_aligned", "group__aligned.html#ga68930196751fa2cca9e1fd0d71bade56", null ], diff --git a/docs/group__analysis.html b/docs/group__analysis.html index 2487c240..883099fe 100644 --- a/docs/group__analysis.html +++ b/docs/group__analysis.html @@ -3,7 +3,7 @@ - + mi-malloc: Heap Introspection @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@
    - +
    @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -119,22 +115,22 @@ Data Structures

    Typedefs

    typedef bool() mi_block_visit_fun(const mi_heap_t *heap, const mi_heap_area_t *area, void *block, size_t block_size, void *arg) - Visitor function passed to mi_heap_visit_blocks() More...
    + Visitor function passed to mi_heap_visit_blocks() More...
      - + - + - + - +

    Functions

    bool mi_heap_contains_block (mi_heap_t *heap, const void *p)
     Does a heap contain a pointer to a previously allocated block? More...
     Does a heap contain a pointer to a previously allocated block? More...
     
    bool mi_heap_check_owned (mi_heap_t *heap, const void *p)
     Check safely if any pointer is part of a heap. More...
     Check safely if any pointer is part of a heap. More...
     
    bool mi_check_owned (const void *p)
     Check safely if any pointer is part of the default heap of this thread. More...
     Check safely if any pointer is part of the default heap of this thread. More...
     
    bool mi_heap_visit_blocks (const mi_heap_t *heap, bool visit_all_blocks, mi_block_visit_fun *visitor, void *arg)
     Visit all areas and blocks in a heap. More...
     Visit all areas and blocks in a heap. More...
     

    Detailed Description

    @@ -376,9 +372,7 @@ bytes in use by allocated blocks diff --git a/docs/group__cpp.html b/docs/group__cpp.html index 88c75888..e81179fe 100644 --- a/docs/group__cpp.html +++ b/docs/group__cpp.html @@ -3,7 +3,7 @@ - + mi-malloc: C++ wrappers @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@
    - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -118,25 +114,25 @@ Data Structures

    Functions

    void * mi_new (std::size_t n) noexcept(false) - like mi_malloc(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. More...
    + like mi_malloc(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. More...
      void * mi_new_n (size_t count, size_t size) noexcept(false) - like mi_mallocn(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. More...
    + like mi_mallocn(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. More...
      void * mi_new_aligned (std::size_t n, std::align_val_t alignment) noexcept(false) - like mi_malloc_aligned(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. More...
    + like mi_malloc_aligned(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. More...
      void * mi_new_nothrow (size_t n) - like mi_malloc, but when out of memory, use std::get_new_handler but return NULL on failure. More...
    + like mi_malloc, but when out of memory, use std::get_new_handler but return NULL on failure. More...
      void * mi_new_aligned_nothrow (size_t n, size_t alignment) - like mi_malloc_aligned, but when out of memory, use std::get_new_handler but return NULL on failure. More...
    + like mi_malloc_aligned, but when out of memory, use std::get_new_handler but return NULL on failure. More...
      void * mi_new_realloc (void *p, size_t newsize) - like mi_realloc(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. More...
    + like mi_realloc(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. More...
      void * mi_new_reallocn (void *p, size_t newcount, size_t size) - like mi_reallocn(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. More...
    + like mi_reallocn(), but when out of memory, use std::get_new_handler and raise std::bad_alloc exception on failure. More...
     

    Detailed Description

    @@ -158,7 +154,10 @@ Functions struct mi_stl_allocator< T >

    std::allocator implementation for mimalloc for use in STL containers.

    -

    For example:

    std::vector<int, mi_stl_allocator<int> > vec;
    vec.push_back(1);
    vec.pop_back();
    +

    For example:

    std::vector<int, mi_stl_allocator<int> > vec;
    +
    vec.push_back(1);
    +
    vec.pop_back();
    +

    Function Documentation

    @@ -387,9 +386,7 @@ struct mi_stl_allocator< T > diff --git a/docs/group__extended.html b/docs/group__extended.html index 12e51cbb..e5499118 100644 --- a/docs/group__extended.html +++ b/docs/group__extended.html @@ -3,7 +3,7 @@ - + mi-malloc: Extended Functions @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@ - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -113,82 +109,88 @@ $(document).ready(function(){initNavTree('group__extended.html','');});

    Macros

    #define MI_SMALL_SIZE_MAX - Maximum size allowed for small allocations in mi_malloc_small and mi_zalloc_small (usually 128*sizeof(void*) (= 1KB on 64-bit systems)) More...
    + Maximum size allowed for small allocations in mi_malloc_small and mi_zalloc_small (usually 128*sizeof(void*) (= 1KB on 64-bit systems)) More...
      - + - + - +

    Typedefs

    typedef void() mi_deferred_free_fun(bool force, unsigned long long heartbeat, void *arg)
     Type of deferred free functions. More...
     Type of deferred free functions. More...
     
    typedef void() mi_output_fun(const char *msg, void *arg)
     Type of output functions. More...
     Type of output functions. More...
     
    typedef void() mi_error_fun(int err, void *arg)
     Type of error callback functions. More...
     Type of error callback functions. More...
     
    - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + - + - + - + - +

    Functions

    void * mi_malloc_small (size_t size)
     Allocate a small object. More...
     Allocate a small object. More...
     
    void * mi_zalloc_small (size_t size)
     Allocate a zero initialized small object. More...
     Allocate a zero initialized small object. More...
     
    size_t mi_usable_size (void *p)
     Return the available bytes in a memory block. More...
     Return the available bytes in a memory block. More...
     
    size_t mi_good_size (size_t size)
     Return the used allocation size. More...
     Return the used allocation size. More...
     
    void mi_collect (bool force)
     Eagerly free memory. More...
     Eagerly free memory. More...
     
    void mi_stats_print (void *out)
     Deprecated. More...
     Deprecated. More...
     
    void mi_stats_print_out (mi_output_fun *out, void *arg)
     Print the main statistics. More...
     Print the main statistics. More...
     
    void mi_stats_reset (void)
     Reset statistics. More...
     Reset statistics. More...
     
    void mi_stats_merge (void)
     Merge thread local statistics with the main statistics and reset. More...
     Merge thread local statistics with the main statistics and reset. More...
     
    void mi_thread_init (void)
     Initialize mimalloc on a thread. More...
     Initialize mimalloc on a thread. More...
     
    void mi_thread_done (void)
     Uninitialize mimalloc on a thread. More...
     Uninitialize mimalloc on a thread. More...
     
    void mi_thread_stats_print_out (mi_output_fun *out, void *arg)
     Print out heap statistics for this thread. More...
     Print out heap statistics for this thread. More...
     
    void mi_register_deferred_free (mi_deferred_free_fun *deferred_free, void *arg)
     Register a deferred free function. More...
     Register a deferred free function. More...
     
    void mi_register_output (mi_output_fun *out, void *arg)
     Register an output function. More...
     Register an output function. More...
     
    void mi_register_error (mi_error_fun *errfun, void *arg)
     Register an error callback function. More...
     Register an error callback function. More...
     
    bool mi_is_in_heap_region (const void *p)
     Is a pointer part of our heap? More...
     Is a pointer part of our heap? More...
     
    int mi_reserve_os_memory (size_t size, bool commit, bool allow_large)
     Reserve OS memory for use by mimalloc. More...
     
    bool mi_manage_os_memory (void *start, size_t size, bool is_committed, bool is_large, bool is_zero, int numa_node)
     Manage a particular memory area for use by mimalloc. More...
     
    int mi_reserve_huge_os_pages_interleave (size_t pages, size_t numa_nodes, size_t timeout_msecs)
     Reserve pages of huge OS pages (1GiB) evenly divided over numa_nodes nodes, but stops after at most timeout_msecs seconds. More...
     Reserve pages of huge OS pages (1GiB) evenly divided over numa_nodes nodes, but stops after at most timeout_msecs seconds. More...
     
    int mi_reserve_huge_os_pages_at (size_t pages, int numa_node, size_t timeout_msecs)
     Reserve pages of huge OS pages (1GiB) at a specific numa_node, but stops after at most timeout_msecs seconds. More...
     Reserve pages of huge OS pages (1GiB) at a specific numa_node, but stops after at most timeout_msecs seconds. More...
     
    bool mi_is_redirected ()
     Is the C runtime malloc API redirected? More...
     Is the C runtime malloc API redirected? More...
     
    void mi_process_info (size_t *elapsed_msecs, size_t *user_msecs, size_t *system_msecs, size_t *current_rss, size_t *peak_rss, size_t *current_commit, size_t *peak_commit, size_t *page_faults)
     Return process information (time and memory usage). More...
     Return process information (time and memory usage). More...
     

    Detailed Description

    @@ -414,6 +416,72 @@ Functions
    Returns
    a pointer to newly allocated memory of at least size bytes, or NULL if out of memory. This function is meant for use in run-time systems for best performance and does not check if size was indeed small – use with care!
    +
    + + +

    ◆ mi_manage_os_memory()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    bool mi_manage_os_memory (void * start,
    size_t size,
    bool is_committed,
    bool is_large,
    bool is_zero,
    int numa_node 
    )
    +
    + +

    Manage a particular memory area for use by mimalloc.

    +

    This is just like mi_reserve_os_memory except that the area should already be allocated in some manner and available for use my mimalloc.

    Parameters
    + + + + + + + +
    startStart of the memory area
    sizeThe size of the memory area.
    commitIs the area already committed?
    is_largeDoes it consist of large OS pages? Set this to true as well for memory that should not be decommitted or protected (like rdma etc.)
    is_zeroDoes the area consists of zero's?
    numa_nodePossible associated numa node or -1.
    +
    +
    +
    Returns
    true if successful, and false on error.
    +
    @@ -706,6 +774,51 @@ Functions
    Returns
    0 if successfull, ENOMEM if running out of memory, or ETIMEDOUT if timed out.

    The reserved memory is used by mimalloc to satisfy allocations. May quit before timeout_msecs are expired if it estimates it will take more than 1.5 times timeout_msecs. The time limit is needed because on some operating systems it can take a long time to reserve contiguous memory if the physical memory is fragmented.

    + + + +

    ◆ mi_reserve_os_memory()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    int mi_reserve_os_memory (size_t size,
    bool commit,
    bool allow_large 
    )
    +
    + +

    Reserve OS memory for use by mimalloc.

    +

    Reserved areas are used before allocating from the OS again. By reserving a large area upfront, allocation can be more efficient, and can be better managed on systems without mmap/VirtualAlloc (like WASM for example).

    Parameters
    + + + + +
    sizeThe size to reserve.
    commitCommit the memory upfront.
    allow_largeAllow large OS pages (2MiB) to be used?
    +
    +
    +
    Returns
    0 if successful, and an error code otherwise (e.g. ENOMEM).
    +
    @@ -958,9 +1071,7 @@ Functions diff --git a/docs/group__extended.js b/docs/group__extended.js index ed4a8b46..c217aaca 100644 --- a/docs/group__extended.js +++ b/docs/group__extended.js @@ -9,12 +9,14 @@ var group__extended = [ "mi_is_in_heap_region", "group__extended.html#ga5f071b10d4df1c3658e04e7fd67a94e6", null ], [ "mi_is_redirected", "group__extended.html#gaad25050b19f30cd79397b227e0157a3f", null ], [ "mi_malloc_small", "group__extended.html#ga7136c2e55cb22c98ecf95d08d6debb99", null ], + [ "mi_manage_os_memory", "group__extended.html#ga4c6486a1fdcd7a423b5f25fe4be8e0cf", null ], [ "mi_process_info", "group__extended.html#ga7d862c2affd5790381da14eb102a364d", null ], [ "mi_register_deferred_free", "group__extended.html#ga3460a6ca91af97be4058f523d3cb8ece", null ], [ "mi_register_error", "group__extended.html#gaa1d55e0e894be240827e5d87ec3a1f45", null ], [ "mi_register_output", "group__extended.html#gae5b17ff027cd2150b43a33040250cf3f", null ], [ "mi_reserve_huge_os_pages_at", "group__extended.html#ga7795a13d20087447281858d2c771cca1", null ], [ "mi_reserve_huge_os_pages_interleave", "group__extended.html#ga3132f521fb756fc0e8ec0b74fb58df50", null ], + [ "mi_reserve_os_memory", "group__extended.html#ga00ec3324b6b2591c7fe3677baa30a767", null ], [ "mi_stats_merge", "group__extended.html#ga854b1de8cb067c7316286c28b2fcd3d1", null ], [ "mi_stats_print", "group__extended.html#ga2d126e5c62d3badc35445e5d84166df2", null ], [ "mi_stats_print_out", "group__extended.html#ga537f13b299ddf801e49a5a94fde02c79", null ], diff --git a/docs/group__heap.html b/docs/group__heap.html index 1a38c936..0f21ea42 100644 --- a/docs/group__heap.html +++ b/docs/group__heap.html @@ -3,7 +3,7 @@ - + mi-malloc: Heap Allocation @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@ - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -112,55 +108,55 @@ $(document).ready(function(){initNavTree('group__heap.html','');});

    Typedefs

    typedef struct mi_heap_s mi_heap_t - Type of first-class heaps. More...
    + Type of first-class heaps. More...
      - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1071,9 +1067,7 @@ Functions diff --git a/docs/group__malloc.html b/docs/group__malloc.html index 224c4b08..2dc16656 100644 --- a/docs/group__malloc.html +++ b/docs/group__malloc.html @@ -3,7 +3,7 @@ - +mi-malloc: Basic Allocation @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ @@ -60,10 +56,10 @@

    Functions

    mi_heap_tmi_heap_new ()
     Create a new heap that can be used for allocation. More...
     Create a new heap that can be used for allocation. More...
     
    void mi_heap_delete (mi_heap_t *heap)
     Delete a previously allocated heap. More...
     Delete a previously allocated heap. More...
     
    void mi_heap_destroy (mi_heap_t *heap)
     Destroy a heap, freeing all its still allocated blocks. More...
     Destroy a heap, freeing all its still allocated blocks. More...
     
    mi_heap_tmi_heap_set_default (mi_heap_t *heap)
     Set the default heap to use for mi_malloc() et al. More...
     Set the default heap to use for mi_malloc() et al. More...
     
    mi_heap_tmi_heap_get_default ()
     Get the default heap that is used for mi_malloc() et al. More...
     Get the default heap that is used for mi_malloc() et al. More...
     
    mi_heap_tmi_heap_get_backing ()
     Get the backing heap. More...
     Get the backing heap. More...
     
    void mi_heap_collect (mi_heap_t *heap, bool force)
     Release outstanding resources in a specific heap. More...
     Release outstanding resources in a specific heap. More...
     
    void * mi_heap_malloc (mi_heap_t *heap, size_t size)
     Allocate in a specific heap. More...
     Allocate in a specific heap. More...
     
    void * mi_heap_malloc_small (mi_heap_t *heap, size_t size)
     Allocate a small object in a specific heap. More...
     Allocate a small object in a specific heap. More...
     
    void * mi_heap_zalloc (mi_heap_t *heap, size_t size)
     Allocate zero-initialized in a specific heap. More...
     Allocate zero-initialized in a specific heap. More...
     
    void * mi_heap_calloc (mi_heap_t *heap, size_t count, size_t size)
     Allocate count zero-initialized elements in a specific heap. More...
     Allocate count zero-initialized elements in a specific heap. More...
     
    void * mi_heap_mallocn (mi_heap_t *heap, size_t count, size_t size)
     Allocate count elements in a specific heap. More...
     Allocate count elements in a specific heap. More...
     
    char * mi_heap_strdup (mi_heap_t *heap, const char *s)
     Duplicate a string in a specific heap. More...
     Duplicate a string in a specific heap. More...
     
    char * mi_heap_strndup (mi_heap_t *heap, const char *s, size_t n)
     Duplicate a string of at most length n in a specific heap. More...
     Duplicate a string of at most length n in a specific heap. More...
     
    char * mi_heap_realpath (mi_heap_t *heap, const char *fname, char *resolved_name)
     Resolve a file path name using a specific heap to allocate the result. More...
     Resolve a file path name using a specific heap to allocate the result. More...
     
    void * mi_heap_realloc (mi_heap_t *heap, void *p, size_t newsize)
     
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -111,43 +107,43 @@ $(document).ready(function(){initNavTree('group__malloc.html','');});

    Functions

    void mi_free (void *p) - Free previously allocated memory. More...
    + Free previously allocated memory. More...
      void * mi_malloc (size_t size) - Allocate size bytes. More...
    + Allocate size bytes. More...
      void * mi_zalloc (size_t size) - Allocate zero-initialized size bytes. More...
    + Allocate zero-initialized size bytes. More...
      void * mi_calloc (size_t count, size_t size) - Allocate zero-initialized count elements of size bytes. More...
    + Allocate zero-initialized count elements of size bytes. More...
      void * mi_realloc (void *p, size_t newsize) - Re-allocate memory to newsize bytes. More...
    + Re-allocate memory to newsize bytes. More...
      void * mi_recalloc (void *p, size_t count, size_t size) - Re-allocate memory to count elements of size bytes, with extra memory initialized to zero. More...
    + Re-allocate memory to count elements of size bytes, with extra memory initialized to zero. More...
      void * mi_expand (void *p, size_t newsize) - Try to re-allocate memory to newsize bytes in place. More...
    + Try to re-allocate memory to newsize bytes in place. More...
      void * mi_mallocn (size_t count, size_t size) - Allocate count elements of size bytes. More...
    + Allocate count elements of size bytes. More...
      void * mi_reallocn (void *p, size_t count, size_t size) - Re-allocate memory to count elements of size bytes. More...
    + Re-allocate memory to count elements of size bytes. More...
      void * mi_reallocf (void *p, size_t newsize) - Re-allocate memory to newsize bytes,. More...
    + Re-allocate memory to newsize bytes,. More...
      char * mi_strdup (const char *s) - Allocate and duplicate a string. More...
    + Allocate and duplicate a string. More...
      char * mi_strndup (const char *s, size_t n) - Allocate and duplicate a string up to n bytes. More...
    + Allocate and duplicate a string up to n bytes. More...
      char * mi_realpath (const char *fname, char *resolved_name) - Resolve a file path name. More...
    + Resolve a file path name. More...
     

    Detailed Description

    @@ -635,9 +631,7 @@ mi_zallocn() diff --git a/docs/group__options.html b/docs/group__options.html index 9425765e..f92905d4 100644 --- a/docs/group__options.html +++ b/docs/group__options.html @@ -3,7 +3,7 @@ - + mi-malloc: Runtime Options @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@
    - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -112,25 +108,27 @@ $(document).ready(function(){initNavTree('group__options.html','');});

    Enumerations

    enum  mi_option_t {
    -  mi_option_show_errors, -mi_option_show_stats, -mi_option_verbose, -mi_option_eager_commit, -
    -  mi_option_eager_region_commit, -mi_option_large_os_pages, -mi_option_reserve_huge_os_pages, -mi_option_segment_cache, -
    -  mi_option_page_reset, -mi_option_segment_reset, -mi_option_reset_delay, -mi_option_use_numa_nodes, -
    -  mi_option_reset_decommits, -mi_option_eager_commit_delay, -mi_option_os_tag, -_mi_option_last +  mi_option_show_errors +, mi_option_show_stats +, mi_option_verbose +, mi_option_eager_commit +,
    +  mi_option_eager_region_commit +, mi_option_large_os_pages +, mi_option_reserve_huge_os_pages +, mi_option_reserve_huge_os_pages_at +,
    +  mi_option_segment_cache +, mi_option_page_reset +, mi_option_segment_reset +, mi_option_reset_delay +,
    +  mi_option_use_numa_nodes +, mi_option_reset_decommits +, mi_option_eager_commit_delay +, mi_option_os_tag +,
    +  _mi_option_last
    }  Runtime options. More...
    @@ -186,6 +184,8 @@ Functions mi_option_reserve_huge_os_pages 

    The number of huge OS pages (1GiB in size) to reserve at the start of the program.

    +mi_option_reserve_huge_os_pages_at 

    Reserve huge OS pages at node N.

    + mi_option_segment_cache 

    The number of segments per thread to keep cached.

    mi_option_page_reset 

    Reset page memory after mi_option_reset_delay milliseconds when it becomes free.

    @@ -397,9 +397,7 @@ Functions diff --git a/docs/group__options.js b/docs/group__options.js index 9aaf2318..c8836cdc 100644 --- a/docs/group__options.js +++ b/docs/group__options.js @@ -8,6 +8,7 @@ var group__options = [ "mi_option_eager_region_commit", "group__options.html#ggafebf7ed116adb38ae5218bc3ce06884ca32ce97ece29f69e82579679cf8a307ad", null ], [ "mi_option_large_os_pages", "group__options.html#ggafebf7ed116adb38ae5218bc3ce06884ca4192d491200d0055df0554d4cf65054e", null ], [ "mi_option_reserve_huge_os_pages", "group__options.html#ggafebf7ed116adb38ae5218bc3ce06884caca7ed041be3b0b9d0b82432c7bf41af2", null ], + [ "mi_option_reserve_huge_os_pages_at", "group__options.html#ggafebf7ed116adb38ae5218bc3ce06884caa13e7926d4339d2aa6fbf61d4473fd5c", null ], [ "mi_option_segment_cache", "group__options.html#ggafebf7ed116adb38ae5218bc3ce06884ca2ecbe7ef32f5c84de3739aa4f0b805a1", null ], [ "mi_option_page_reset", "group__options.html#ggafebf7ed116adb38ae5218bc3ce06884cada854dd272c66342f18a93ee254a2968", null ], [ "mi_option_segment_reset", "group__options.html#ggafebf7ed116adb38ae5218bc3ce06884cafb121d30d87591850d5410ccc3a95c6d", null ], diff --git a/docs/group__posix.html b/docs/group__posix.html index fe3a88e1..539f7ec6 100644 --- a/docs/group__posix.html +++ b/docs/group__posix.html @@ -3,7 +3,7 @@ - + mi-malloc: Posix @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@
    - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -115,7 +111,7 @@ Functions size_t mi_malloc_usable_size (const void *p)   void mi_cfree (void *p) - Just as free but also checks if the pointer p belongs to our heap. More...
    + Just as free but also checks if the pointer p belongs to our heap. More...
      int mi_posix_memalign (void **p, size_t alignment, size_t size)   @@ -130,7 +126,11 @@ Functions void * mi_aligned_alloc (size_t alignment, size_t size)   void * mi_reallocarray (void *p, size_t count, size_t size) + Correspond s to reallocarray in FreeBSD. More...
      +int mi_reallocarr (void *p, size_t count, size_t size) + Corresponds to reallocarr in NetBSD. More...
    +  void mi_free_size (void *p, size_t size)   void mi_free_size_aligned (void *p, size_t size, size_t alignment) @@ -428,6 +428,42 @@ Functions
    +
    + + +

    ◆ mi_reallocarr()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    int mi_reallocarr (void * p,
    size_t count,
    size_t size 
    )
    +
    + +

    Corresponds to reallocarr in NetBSD.

    +
    @@ -462,6 +498,8 @@ Functions
    +

    Correspond s to reallocarray in FreeBSD.

    +
    @@ -487,9 +525,7 @@ Functions diff --git a/docs/group__posix.js b/docs/group__posix.js index e43453d9..50c248c8 100644 --- a/docs/group__posix.js +++ b/docs/group__posix.js @@ -11,6 +11,7 @@ var group__posix = [ "mi_memalign", "group__posix.html#gaab7fa71ea93b96873f5d9883db57d40e", null ], [ "mi_posix_memalign", "group__posix.html#gacff84f226ba9feb2031b8992e5579447", null ], [ "mi_pvalloc", "group__posix.html#gaeb325c39b887d3b90d85d1eb1712fb1e", null ], + [ "mi_reallocarr", "group__posix.html#ga7e1934d60a3e697950eeb48e042bfad5", null ], [ "mi_reallocarray", "group__posix.html#ga48fad8648a2f1dab9c87ea9448a52088", null ], [ "mi_valloc", "group__posix.html#ga73baaf5951f5165ba0763d0c06b6a93b", null ] ]; \ No newline at end of file diff --git a/docs/group__typed.html b/docs/group__typed.html index 5cbfbd6b..c19c7f4a 100644 --- a/docs/group__typed.html +++ b/docs/group__typed.html @@ -3,7 +3,7 @@ - + mi-malloc: Typed Macros @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@ - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -111,42 +107,44 @@ $(document).ready(function(){initNavTree('group__typed.html','');});

    Macros

    #define mi_malloc_tp(tp) - Allocate a block of type tp. More...
    + Allocate a block of type tp. More...
      #define mi_zalloc_tp(tp) - Allocate a zero-initialized block of type tp. More...
    + Allocate a zero-initialized block of type tp. More...
      #define mi_calloc_tp(tp, count) - Allocate count zero-initialized blocks of type tp. More...
    + Allocate count zero-initialized blocks of type tp. More...
      #define mi_mallocn_tp(tp, count) - Allocate count blocks of type tp. More...
    + Allocate count blocks of type tp. More...
      #define mi_reallocn_tp(p, tp, count) - Re-allocate to count blocks of type tp. More...
    + Re-allocate to count blocks of type tp. More...
      #define mi_heap_malloc_tp(hp, tp) - Allocate a block of type tp in a heap hp. More...
    + Allocate a block of type tp in a heap hp. More...
      #define mi_heap_zalloc_tp(hp, tp) - Allocate a zero-initialized block of type tp in a heap hp. More...
    + Allocate a zero-initialized block of type tp in a heap hp. More...
      #define mi_heap_calloc_tp(hp, tp, count) - Allocate count zero-initialized blocks of type tp in a heap hp. More...
    + Allocate count zero-initialized blocks of type tp in a heap hp. More...
      #define mi_heap_mallocn_tp(hp, tp, count) - Allocate count blocks of type tp in a heap hp. More...
    + Allocate count blocks of type tp in a heap hp. More...
      #define mi_heap_reallocn_tp(hp, p, tp, count) - Re-allocate to count blocks of type tp in a heap hp. More...
    + Re-allocate to count blocks of type tp in a heap hp. More...
      #define mi_heap_recalloc_tp(hp, p, tp, count) - Re-allocate to count zero initialized blocks of type tp in a heap hp. More...
    + Re-allocate to count zero initialized blocks of type tp in a heap hp. More...
     

    Detailed Description

    Typed allocation macros.

    -

    For example:

    int* p = mi_malloc_tp(int)

    Macro Definition Documentation

    +

    For example:

    int* p = mi_malloc_tp(int)
    +
    #define mi_malloc_tp(tp)
    Allocate a block of type tp.
    Definition: mimalloc-doc.h:692
    +

    Macro Definition Documentation

    ◆ mi_calloc_tp

    @@ -417,7 +415,8 @@ Macros
    Returns
    A pointer to an object of type tp, or NULL if out of memory.
    -

    Example:

    int* p = mi_malloc_tp(int)
    See also
    mi_malloc()
    +

    Example:

    int* p = mi_malloc_tp(int)
    +
    See also
    mi_malloc()
    @@ -512,9 +511,7 @@ Macros diff --git a/docs/group__zeroinit.html b/docs/group__zeroinit.html index 3c04a5a6..329a7739 100644 --- a/docs/group__zeroinit.html +++ b/docs/group__zeroinit.html @@ -3,7 +3,7 @@ - + mi-malloc: Zero initialized re-allocation @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@ - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -588,9 +584,7 @@ Functions diff --git a/docs/index.html b/docs/index.html index 01af9bec..2ea91215 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ - + mi-malloc: Main Page @@ -13,10 +13,6 @@ - @@ -37,12 +33,12 @@ Logo
    mi-malloc -  1.6 +  1.7/2.0
    - @@ -51,7 +47,7 @@ onblur="searchBox.OnSearchFieldFocus(false)" onkeyup="searchBox.OnSearchFieldChange(event)"/> - +
    @@ -60,10 +56,10 @@
    - + @@ -79,7 +75,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
    @@ -103,13 +99,14 @@ $(document).ready(function(){initNavTree('index.html','');});

    This is the API documentation of the mimalloc allocator (pronounced "me-malloc") – a general purpose allocator with excellent performance characteristics. Initially developed by Daan Leijen for the run-time systems of the Koka and Lean languages.

    -

    It is a drop-in replacement for malloc and can be used in other programs without code changes, for example, on Unix you can use it as:

    > LD_PRELOAD=/usr/bin/libmimalloc.so myprogram

    Notable aspects of the design include:

    +

    It is a drop-in replacement for malloc and can be used in other programs without code changes, for example, on Unix you can use it as:

    > LD_PRELOAD=/usr/bin/libmimalloc.so myprogram
    +

    Notable aspects of the design include: