diff --git a/.gitattributes b/.gitattributes index 1534e778..0332e031 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,3 +9,4 @@ *.patch binary *.dll binary *.lib binary +*.exe binary diff --git a/CMakeLists.txt b/CMakeLists.txt index aa2ea99f..5f794004 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,9 +22,11 @@ option(MI_BUILD_TESTS "Build test executables" ON) option(MI_DEBUG_TSAN "Build with thread sanitizer (needs clang)" OFF) option(MI_DEBUG_UBSAN "Build with undefined-behavior sanitizer (needs clang++)" OFF) option(MI_DEBUG_TRACE "Store allocation stack trace in each heap block to debug heap block overflows or corruption" OFF) + +# deprecated options option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode (deprecated, use MI_DEBUG_FULL instead)" OFF) -option(MI_INSTALL_TOPLEVEL "Install directly into $CMAKE_INSTALL_PREFIX instead of PREFIX/lib/mimalloc-version" OFF) -option(MI_USE_LIBATOMIC "Explicitly link with -latomic (on older systems)" OFF) +option(MI_INSTALL_TOPLEVEL "Install directly into $CMAKE_INSTALL_PREFIX instead of PREFIX/lib/mimalloc-version (deprecated)" OFF) +option(MI_USE_LIBATOMIC "Explicitly link with -latomic (on older systems) (deprecated and detected automatically)" OFF) set(MI_PADDING_EXTRA 0 CACHE STRING "Specify extra bytes for padding in each heap block (to debug heap block overflows)") @@ -356,6 +358,7 @@ if (MI_BUILD_STATIC) endif() install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) endif() # install include files @@ -392,21 +395,17 @@ endif() # ----------------------------------------------------------------------------- if (MI_BUILD_TESTS) - add_executable(mimalloc-test-api test/test-api.c) - target_compile_definitions(mimalloc-test-api PRIVATE ${mi_defines}) - target_compile_options(mimalloc-test-api PRIVATE ${mi_cflags}) - target_include_directories(mimalloc-test-api PRIVATE include) - target_link_libraries(mimalloc-test-api PRIVATE mimalloc ${mi_libraries}) - - add_executable(mimalloc-test-stress test/test-stress.c) - target_compile_definitions(mimalloc-test-stress PRIVATE ${mi_defines}) - target_compile_options(mimalloc-test-stress PRIVATE ${mi_cflags}) - target_include_directories(mimalloc-test-stress PRIVATE include) - target_link_libraries(mimalloc-test-stress PRIVATE mimalloc ${mi_libraries}) - enable_testing() - add_test(test_api, mimalloc-test-api) - add_test(test_stress, mimalloc-test-stress) + + foreach(TEST_NAME api api-fill stress) + add_executable(mimalloc-test-${TEST_NAME} test/test-${TEST_NAME}.c) + target_compile_definitions(mimalloc-test-${TEST_NAME} PRIVATE ${mi_defines}) + target_compile_options(mimalloc-test-${TEST_NAME} PRIVATE ${mi_cflags}) + target_include_directories(mimalloc-test-${TEST_NAME} PRIVATE include) + target_link_libraries(mimalloc-test-${TEST_NAME} PRIVATE mimalloc ${mi_libraries}) + + add_test(NAME test-${TEST_NAME} COMMAND mimalloc-test-${TEST_NAME}) + endforeach() endif() # ----------------------------------------------------------------------------- diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 7261fc13..cfaf1876 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -43,7 +43,7 @@ jobs: solution: $(BuildType)/libmimalloc.sln configuration: '$(MSBuildConfiguration)' msbuildArguments: -m - - script: ctest --verbose --timeout 120 + - script: ctest --verbose --timeout 120 -C $(MSBuildConfiguration) workingDirectory: $(BuildType) displayName: CTest #- script: $(BuildType)\$(BuildType)\mimalloc-test-stress @@ -115,7 +115,7 @@ jobs: displayName: macOS pool: vmImage: - macOS-latest + macOS-latest strategy: matrix: Debug: diff --git a/bin/mimalloc-redirect.dll b/bin/mimalloc-redirect.dll index b7bf1d09..83b6bd4f 100644 Binary files a/bin/mimalloc-redirect.dll and b/bin/mimalloc-redirect.dll differ diff --git a/bin/mimalloc-redirect.lib b/bin/mimalloc-redirect.lib index 550db8ec..059fb870 100644 Binary files a/bin/mimalloc-redirect.lib and b/bin/mimalloc-redirect.lib differ diff --git a/bin/mimalloc-redirect32.dll b/bin/mimalloc-redirect32.dll index 7ba303af..2892d459 100644 Binary files a/bin/mimalloc-redirect32.dll and b/bin/mimalloc-redirect32.dll differ diff --git a/bin/mimalloc-redirect32.lib b/bin/mimalloc-redirect32.lib index 66173060..7dadab3d 100644 Binary files a/bin/mimalloc-redirect32.lib and b/bin/mimalloc-redirect32.lib differ diff --git a/bin/minject.exe b/bin/minject.exe new file mode 100644 index 00000000..e576c71f Binary files /dev/null and b/bin/minject.exe differ diff --git a/bin/minject32.exe b/bin/minject32.exe new file mode 100644 index 00000000..1eb8a75d Binary files /dev/null and b/bin/minject32.exe differ diff --git a/doc/doxyfile b/doc/doxyfile index 6c1e30a0..73266f4e 100644 --- a/doc/doxyfile +++ b/doc/doxyfile @@ -1,4 +1,4 @@ -# Doxyfile 1.8.15 +# Doxyfile 1.9.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -38,7 +38,7 @@ PROJECT_NAME = mi-malloc # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.6 +PROJECT_NUMBER = 1.7/2.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a @@ -197,6 +197,16 @@ SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + # If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first # line (until the first dot) of a Qt-style comment as the brief description. If # set to NO, the Qt-style will behave just like regular Qt-style comments (thus @@ -217,6 +227,14 @@ QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. @@ -253,12 +271,6 @@ TAB_SIZE = 2 ALIASES = -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all @@ -299,19 +311,22 @@ OPTIMIZE_OUTPUT_SLICE = NO # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, # Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: # FortranFree, unknown formatted Fortran: Fortran. In the later case the parser # tries to guess whether the code is fixed or free formatted code, this is the -# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is -# Fortran), use: inc=Fortran f=C. +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. EXTENSION_MAPPING = @@ -329,7 +344,7 @@ MARKDOWN_SUPPORT = YES # to that level are automatically included in the table of contents, even if # they do not have an id attribute. # Note: This feature currently applies only to Markdown headings. -# Minimum value: 0, maximum value: 99, default value: 0. +# Minimum value: 0, maximum value: 99, default value: 5. # This tag requires that the tag MARKDOWN_SUPPORT is set to YES. TOC_INCLUDE_HEADINGS = 0 @@ -445,6 +460,19 @@ TYPEDEF_HIDES_STRUCT = YES LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which efficively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -465,6 +493,12 @@ EXTRACT_ALL = YES EXTRACT_PRIVATE = NO +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. # The default value is: NO. @@ -502,6 +536,13 @@ EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = NO +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation @@ -519,8 +560,8 @@ HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO # If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. +# declarations. If set to NO, these declarations will be included in the +# documentation. # The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO @@ -539,11 +580,18 @@ HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. # The default value is: system dependent. CASE_SENSE_NAMES = NO @@ -782,7 +830,10 @@ WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. # The default value is: NO. WARN_AS_ERROR = NO @@ -818,8 +869,8 @@ INPUT = mimalloc-doc.h # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: https://www.gnu.org/software/libiconv/) for the list of -# possible encodings. +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. # The default value is: UTF-8. INPUT_ENCODING = UTF-8 @@ -832,11 +883,15 @@ INPUT_ENCODING = UTF-8 # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, -# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf, *.qsf and *.ice. +# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), +# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl, +# *.ucf, *.qsf and *.ice. FILE_PATTERNS = *.c \ *.cc \ @@ -1094,16 +1149,22 @@ USE_HTAGS = NO VERBATIM_HEADERS = YES # If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the -# cost of reduced performance. This can be particularly helpful with template -# rich C++ code for which doxygen's built-in parser lacks the necessary type -# information. +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse_libclang=ON option for CMake. # The default value is: NO. CLANG_ASSISTED_PARSING = NO +# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to +# YES then doxygen will add the directory of each input to the include path. +# The default value is: YES. + +CLANG_ADD_INC_PATHS = YES + # If clang assisted parsing is enabled you can provide the compiler with command # line options that you would normally use when invoking the compiler. Note that # the include paths will already be set by doxygen for the files and directories @@ -1113,10 +1174,13 @@ CLANG_ASSISTED_PARSING = NO CLANG_OPTIONS = # If clang assisted parsing is enabled you can provide the clang parser with the -# path to the compilation database (see: -# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files -# were built. This is equivalent to specifying the "-p" option to a clang tool, -# such as clang-check. These options will then be passed to the parser. +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse_libclang=ON option for CMake. @@ -1133,13 +1197,6 @@ CLANG_DATABASE_PATH = ALPHABETICAL_INDEX = YES -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored @@ -1278,9 +1335,9 @@ HTML_TIMESTAMP = NO # If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML # documentation will contain a main index with vertical navigation menus that -# are dynamically created via Javascript. If disabled, the navigation index will +# are dynamically created via JavaScript. If disabled, the navigation index will # consists of multiple levels of tabs that are statically embedded in every HTML -# page. Disable this option to support browsers that do not have Javascript, +# page. Disable this option to support browsers that do not have JavaScript, # like the Qt help browser. # The default value is: YES. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1310,10 +1367,11 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: https://developer.apple.com/xcode/), introduced with OSX -# 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy # genXcode/_index.html for more information. @@ -1355,8 +1413,8 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. +# (see: +# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML @@ -1386,7 +1444,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). +# (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. @@ -1431,7 +1489,8 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1439,8 +1498,8 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1448,30 +1507,30 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = @@ -1548,6 +1607,17 @@ TREEVIEW_WIDTH = 180 EXT_LINKS_IN_WINDOW = NO +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML @@ -1568,8 +1638,14 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# https://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side JavaScript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1581,7 +1657,7 @@ USE_MATHJAX = NO # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1597,7 +1673,7 @@ MATHJAX_FORMAT = HTML-CSS # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of # MathJax from https://www.mathjax.org before deployment. -# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/. +# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest @@ -1611,7 +1687,8 @@ MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1639,7 +1716,7 @@ MATHJAX_CODEFILE = SEARCHENGINE = YES # When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. There +# implemented using a web server instead of a web client using JavaScript. There # are two flavors of web server based searching depending on the EXTERNAL_SEARCH # setting. When disabled, doxygen will generate a PHP script for searching and # an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing @@ -1658,7 +1735,8 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: https://xapian.org/). +# Xapian (see: +# https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1671,8 +1749,9 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: https://xapian.org/). See the section "External Indexing and -# Searching" for details. +# Xapian (see: +# https://xapian.org/). See the section "External Indexing and Searching" for +# details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = @@ -1743,10 +1822,11 @@ LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex # The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to -# generate index for LaTeX. +# generate index for LaTeX. In case there is no backslash (\) as first character +# it will be automatically added in the LaTeX code. # Note: This tag is used in the generated output file (.tex). # See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat. -# The default value is: \makeindex. +# The default value is: makeindex. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_MAKEINDEX_CMD = \makeindex @@ -1835,9 +1915,11 @@ LATEX_EXTRA_FILES = PDF_HYPERLINKS = YES -# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate -# the PDF file directly from the LaTeX files. Set this option to YES, to get a -# higher quality PDF documentation. +# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as +# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX +# files. Set this option to YES, to get a higher quality PDF documentation. +# +# See also section LATEX_CMD_NAME for selecting the engine. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -2076,6 +2158,10 @@ DOCBOOK_PROGRAMLISTING = NO GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# Configuration options related to Sqlite3 output +#--------------------------------------------------------------------------- + #--------------------------------------------------------------------------- # Configuration options related to the Perl module output #--------------------------------------------------------------------------- @@ -2238,12 +2324,6 @@ EXTERNAL_GROUPS = YES EXTERNAL_PAGES = YES -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of 'which perl'). -# The default file (with absolute path) is: /usr/bin/perl. - -PERL_PATH = /usr/bin/perl - #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- @@ -2257,15 +2337,6 @@ PERL_PATH = /usr/bin/perl CLASS_DIAGRAMS = YES -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. @@ -2363,10 +2434,32 @@ UML_LOOK = NO # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. +# This tag requires that the tag UML_LOOK is set to YES. UML_LIMIT_NUM_FIELDS = 10 +# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and +# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS +# tag is set to YES, doxygen will add type and arguments for attributes and +# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen +# will not generate fields with class member information in the UML graphs. The +# class diagrams will look similar to the default class diagrams but using UML +# notation for the relationships. +# Possible values are: NO, YES and NONE. +# The default value is: NO. +# This tag requires that the tag UML_LOOK is set to YES. + +DOT_UML_DETAILS = NO + +# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters +# to display on a single line. If the actual line length exceeds this threshold +# significantly it will wrapped across multiple lines. Some heuristics are apply +# to avoid ugly line breaks. +# Minimum value: 0, maximum value: 1000, default value: 17. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_WRAP_THRESHOLD = 17 + # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. @@ -2556,9 +2649,11 @@ DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES -# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate # files that are used to generate the various graphs. +# +# Note: This setting is not only used for dot files but also for msc and +# plantuml temporary files. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = YES 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: