Skip to content

Commit 9f01c66

Browse files
committed
update documentation
1 parent f164354 commit 9f01c66

File tree

111 files changed

+2215
-1423
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+2215
-1423
lines changed

doc/mimalloc-doc.h

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Notable aspects of the design include:
5151
programs.
5252
- __secure__: _mimalloc_ can be build in secure mode, adding guard pages,
5353
randomized allocation, encrypted free lists, etc. to protect against various
54-
heap vulnerabilities. The performance penalty is only around 3% on average
54+
heap vulnerabilities. The performance penalty is only around 5% on average
5555
over our benchmarks.
5656
- __first-class heaps__: efficiently create and use multiple heaps to allocate across different regions.
5757
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);
413413
/// This function is relatively fast.
414414
bool mi_is_in_heap_region(const void* p);
415415

416+
/// Reserve OS memory for use by mimalloc. Reserved areas are used
417+
/// before allocating from the OS again. By reserving a large area upfront,
418+
/// allocation can be more efficient, and can be better managed on systems
419+
/// without `mmap`/`VirtualAlloc` (like WASM for example).
420+
/// @param size The size to reserve.
421+
/// @param commit Commit the memory upfront.
422+
/// @param allow_large Allow large OS pages (2MiB) to be used?
423+
/// @return \a 0 if successful, and an error code otherwise (e.g. `ENOMEM`).
424+
int mi_reserve_os_memory(size_t size, bool commit, bool allow_large);
425+
426+
/// Manage a particular memory area for use by mimalloc.
427+
/// This is just like `mi_reserve_os_memory` except that the area should already be
428+
/// allocated in some manner and available for use my mimalloc.
429+
/// @param start Start of the memory area
430+
/// @param size The size of the memory area.
431+
/// @param commit Is the area already committed?
432+
/// @param is_large Does it consist of large OS pages? Set this to \a true as well for memory
433+
/// that should not be decommitted or protected (like rdma etc.)
434+
/// @param is_zero Does the area consists of zero's?
435+
/// @param numa_node Possible associated numa node or `-1`.
436+
/// @return \a true if successful, and \a false on error.
437+
bool mi_manage_os_memory(void* start, size_t size, bool is_committed, bool is_large, bool is_zero, int numa_node);
416438

417439
/// Reserve \a pages of huge OS pages (1GiB) evenly divided over \a numa_nodes nodes,
418440
/// 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
476498
///
477499
/// \{
478500

501+
/// The maximum supported alignment size (currently 1MiB).
502+
#define MI_ALIGNMENT_MAX (1024*1024UL)
503+
479504
/// Allocate \a size bytes aligned by \a alignment.
480505
/// @param size number of bytes to allocate.
481-
/// @param alignment the minimal alignment of the allocated memory.
506+
/// @param alignment the minimal alignment of the allocated memory. Must be less than #MI_ALIGNMENT_MAX.
482507
/// @returns pointer to the allocated memory or \a NULL if out of memory.
483508
/// The returned pointer is aligned by \a alignment, i.e.
484509
/// `(uintptr_t)p % alignment == 0`.
@@ -829,8 +854,14 @@ void* mi_valloc(size_t size);
829854

830855
void* mi_pvalloc(size_t size);
831856
void* mi_aligned_alloc(size_t alignment, size_t size);
857+
858+
/// Correspond s to [reallocarray](https://www.freebsd.org/cgi/man.cgi?query=reallocarray&sektion=3&manpath=freebsd-release-ports)
859+
/// in FreeBSD.
832860
void* mi_reallocarray(void* p, size_t count, size_t size);
833861

862+
/// Corresponds to [reallocarr](https://man.netbsd.org/reallocarr.3) in NetBSD.
863+
int mi_reallocarr(void* p, size_t count, size_t size);
864+
834865
void mi_free_size(void* p, size_t size);
835866
void mi_free_size_aligned(void* p, size_t size, size_t alignment);
836867
void mi_free_aligned(void* p, size_t alignment);
@@ -1161,6 +1192,12 @@ void* calloc(size_t size, size_t n);
11611192
void* realloc(void* p, size_t newsize);
11621193
void free(void* p);
11631194
1195+
void* aligned_alloc(size_t alignment, size_t size);
1196+
char* strdup(const char* s);
1197+
char* strndup(const char* s, size_t n);
1198+
char* realpath(const char* fname, char* resolved_name);
1199+
1200+
11641201
// C++
11651202
void operator delete(void* p);
11661203
void operator delete[](void* p);
@@ -1180,16 +1217,24 @@ int posix_memalign(void** p, size_t alignment, size_t size);
11801217
11811218
// Linux
11821219
void* memalign(size_t alignment, size_t size);
1183-
void* aligned_alloc(size_t alignment, size_t size);
11841220
void* valloc(size_t size);
11851221
void* pvalloc(size_t size);
11861222
size_t malloc_usable_size(void *p);
1223+
void* reallocf(void* p, size_t newsize);
1224+
1225+
// macOS
1226+
void vfree(void* p);
1227+
size_t malloc_size(const void* p);
1228+
size_t malloc_good_size(size_t size);
11871229
11881230
// BSD
11891231
void* reallocarray( void* p, size_t count, size_t size );
11901232
void* reallocf(void* p, size_t newsize);
11911233
void cfree(void* p);
11921234
1235+
// NetBSD
1236+
int reallocarr(void* p, size_t count, size_t size);
1237+
11931238
// Windows
11941239
void* _expand(void* p, size_t newsize);
11951240
size_t _msize(void* p);

docs/annotated.html

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
55
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
6-
<meta name="generator" content="Doxygen 1.8.15"/>
6+
<meta name="generator" content="Doxygen 1.9.1"/>
77
<meta name="viewport" content="width=device-width, initial-scale=1"/>
88
<title>mi-malloc: Data Structures</title>
99
<link href="tabs.css" rel="stylesheet" type="text/css"/>
@@ -13,10 +13,6 @@
1313
<script type="text/javascript" src="resize.js"></script>
1414
<script type="text/javascript" src="navtreedata.js"></script>
1515
<script type="text/javascript" src="navtree.js"></script>
16-
<script type="text/javascript">
17-
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
18-
$(document).ready(initResizable);
19-
/* @license-end */</script>
2016
<link href="search/search.css" rel="stylesheet" type="text/css"/>
2117
<script type="text/javascript" src="search/searchdata.js"></script>
2218
<script type="text/javascript" src="search/search.js"></script>
@@ -37,12 +33,12 @@
3733
<td id="projectlogo"><img alt="Logo" src="mimalloc-logo.svg"/></td>
3834
<td id="projectalign" style="padding-left: 0.5em;">
3935
<div id="projectname">mi-malloc
40-
&#160;<span id="projectnumber">1.6</span>
36+
&#160;<span id="projectnumber">1.7/2.0</span>
4137
</div>
4238
</td>
4339
<td> <div id="MSearchBox" class="MSearchBoxInactive">
4440
<span class="left">
45-
<img id="MSearchSelect" src="search/mag_sel.png"
41+
<img id="MSearchSelect" src="search/mag_sel.svg"
4642
onmouseover="return searchBox.OnSearchSelectShow()"
4743
onmouseout="return searchBox.OnSearchSelectHide()"
4844
alt=""/>
@@ -51,7 +47,7 @@
5147
onblur="searchBox.OnSearchFieldFocus(false)"
5248
onkeyup="searchBox.OnSearchFieldChange(event)"/>
5349
</span><span class="right">
54-
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
50+
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
5551
</span>
5652
</div>
5753
</td>
@@ -60,10 +56,10 @@
6056
</table>
6157
</div>
6258
<!-- end header part -->
63-
<!-- Generated by Doxygen 1.8.15 -->
59+
<!-- Generated by Doxygen 1.9.1 -->
6460
<script type="text/javascript">
6561
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
66-
var searchBox = new SearchBox("searchBox", "search",false,'Search');
62+
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
6763
/* @license-end */
6864
</script>
6965
</div><!-- top -->
@@ -79,7 +75,7 @@
7975
</div>
8076
<script type="text/javascript">
8177
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
82-
$(document).ready(function(){initNavTree('annotated.html','');});
78+
$(document).ready(function(){initNavTree('annotated.html',''); initResizable(); });
8379
/* @license-end */
8480
</script>
8581
<div id="doc-content">
@@ -113,9 +109,7 @@
113109
<!-- start footer part -->
114110
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
115111
<ul>
116-
<li class="footer">Generated by
117-
<a href="http://www.doxygen.org/index.html">
118-
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
112+
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
119113
</ul>
120114
</div>
121115
</body>

docs/bench.html

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
55
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
6-
<meta name="generator" content="Doxygen 1.8.15"/>
6+
<meta name="generator" content="Doxygen 1.9.1"/>
77
<meta name="viewport" content="width=device-width, initial-scale=1"/>
88
<title>mi-malloc: Performance</title>
99
<link href="tabs.css" rel="stylesheet" type="text/css"/>
@@ -13,10 +13,6 @@
1313
<script type="text/javascript" src="resize.js"></script>
1414
<script type="text/javascript" src="navtreedata.js"></script>
1515
<script type="text/javascript" src="navtree.js"></script>
16-
<script type="text/javascript">
17-
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
18-
$(document).ready(initResizable);
19-
/* @license-end */</script>
2016
<link href="search/search.css" rel="stylesheet" type="text/css"/>
2117
<script type="text/javascript" src="search/searchdata.js"></script>
2218
<script type="text/javascript" src="search/search.js"></script>
@@ -37,12 +33,12 @@
3733
<td id="projectlogo"><img alt="Logo" src="mimalloc-logo.svg"/></td>
3834
<td id="projectalign" style="padding-left: 0.5em;">
3935
<div id="projectname">mi-malloc
40-
&#160;<span id="projectnumber">1.6</span>
36+
&#160;<span id="projectnumber">1.7/2.0</span>
4137
</div>
4238
</td>
4339
<td> <div id="MSearchBox" class="MSearchBoxInactive">
4440
<span class="left">
45-
<img id="MSearchSelect" src="search/mag_sel.png"
41+
<img id="MSearchSelect" src="search/mag_sel.svg"
4642
onmouseover="return searchBox.OnSearchSelectShow()"
4743
onmouseout="return searchBox.OnSearchSelectHide()"
4844
alt=""/>
@@ -51,7 +47,7 @@
5147
onblur="searchBox.OnSearchFieldFocus(false)"
5248
onkeyup="searchBox.OnSearchFieldChange(event)"/>
5349
</span><span class="right">
54-
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
50+
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
5551
</span>
5652
</div>
5753
</td>
@@ -60,10 +56,10 @@
6056
</table>
6157
</div>
6258
<!-- end header part -->
63-
<!-- Generated by Doxygen 1.8.15 -->
59+
<!-- Generated by Doxygen 1.9.1 -->
6460
<script type="text/javascript">
6561
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
66-
var searchBox = new SearchBox("searchBox", "search",false,'Search');
62+
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
6763
/* @license-end */
6864
</script>
6965
</div><!-- top -->
@@ -79,7 +75,7 @@
7975
</div>
8076
<script type="text/javascript">
8177
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
82-
$(document).ready(function(){initNavTree('bench.html','');});
78+
$(document).ready(function(){initNavTree('bench.html',''); initResizable(); });
8379
/* @license-end */
8480
</script>
8581
<div id="doc-content">
@@ -103,17 +99,15 @@
10399
</div><!--header-->
104100
<div class="contents">
105101
<div class="textblock"><p>We tested <em>mimalloc</em> 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.</p>
106-
<p>In our benchmarks, <em>mimalloc</em> always outperforms all other leading allocators (<em>jemalloc</em>, <em>tcmalloc</em>, <em>Hoard</em>, etc) (Apr 2019), and usually uses less memory (up to 25% more in the worst case). A nice property is that it does <em>consistently</em> well over the wide range of benchmarks.</p>
102+
<p>In our benchmarks, <em>mimalloc</em> always outperforms all other leading allocators (<em>jemalloc</em>, <em>tcmalloc</em>, <em>Hoard</em>, etc) (Jan 2021), and usually uses less memory (up to 25% more in the worst case). A nice property is that it does <em>consistently</em> well over the wide range of benchmarks.</p>
107103
<p>See the <a href="https://github.com/microsoft/mimalloc#Performance">Performance</a> section in the <em>mimalloc</em> repository for benchmark results, or the the technical report for detailed benchmark results. </p>
108-
</div></div><!-- PageDoc -->
109-
</div><!-- contents -->
104+
</div></div><!-- contents -->
105+
</div><!-- PageDoc -->
110106
</div><!-- doc-content -->
111107
<!-- start footer part -->
112108
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
113109
<ul>
114-
<li class="footer">Generated by
115-
<a href="http://www.doxygen.org/index.html">
116-
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
110+
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
117111
</ul>
118112
</div>
119113
</body>

0 commit comments

Comments
 (0)