mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 23:39:31 +03:00
merge from dev, version bump to 2.1.0
This commit is contained in:
commit
3fc30c4a1e
33 changed files with 124 additions and 75 deletions
|
@ -38,20 +38,20 @@ include(GNUInstallDirs)
|
||||||
include("cmake/mimalloc-config-version.cmake")
|
include("cmake/mimalloc-config-version.cmake")
|
||||||
|
|
||||||
set(mi_sources
|
set(mi_sources
|
||||||
src/stats.c
|
|
||||||
src/random.c
|
|
||||||
src/os.c
|
|
||||||
src/bitmap.c
|
|
||||||
src/arena.c
|
|
||||||
src/segment-cache.c
|
|
||||||
src/segment.c
|
|
||||||
src/page.c
|
|
||||||
src/alloc.c
|
src/alloc.c
|
||||||
src/alloc-aligned.c
|
src/alloc-aligned.c
|
||||||
src/alloc-posix.c
|
src/alloc-posix.c
|
||||||
|
src/arena.c
|
||||||
|
src/bitmap.c
|
||||||
src/heap.c
|
src/heap.c
|
||||||
src/options.c
|
|
||||||
src/init.c
|
src/init.c
|
||||||
|
src/options.c
|
||||||
|
src/os.c
|
||||||
|
src/page.c
|
||||||
|
src/random.c
|
||||||
|
src/segment.c
|
||||||
|
src/segment-cache.c
|
||||||
|
src/stats.c
|
||||||
src/prim/prim.c)
|
src/prim/prim.c)
|
||||||
|
|
||||||
set(mi_cflags "")
|
set(mi_cflags "")
|
||||||
|
@ -92,7 +92,7 @@ if(MI_OVERRIDE)
|
||||||
if(MI_OSX_ZONE)
|
if(MI_OSX_ZONE)
|
||||||
# use zone's on macOS
|
# use zone's on macOS
|
||||||
message(STATUS " Use malloc zone to override malloc (MI_OSX_ZONE=ON)")
|
message(STATUS " Use malloc zone to override malloc (MI_OSX_ZONE=ON)")
|
||||||
list(APPEND mi_sources src/alloc-override-osx.c)
|
list(APPEND mi_sources src/prim/osx/alloc-override-zone.c)
|
||||||
list(APPEND mi_defines MI_OSX_ZONE=1)
|
list(APPEND mi_defines MI_OSX_ZONE=1)
|
||||||
if (NOT MI_OSX_INTERPOSE)
|
if (NOT MI_OSX_INTERPOSE)
|
||||||
message(STATUS " WARNING: zone overriding usually also needs interpose (use -DMI_OSX_INTERPOSE=ON)")
|
message(STATUS " WARNING: zone overriding usually also needs interpose (use -DMI_OSX_INTERPOSE=ON)")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
set(mi_version_major 2)
|
set(mi_version_major 2)
|
||||||
set(mi_version_minor 0)
|
set(mi_version_minor 1)
|
||||||
set(mi_version_patch 9)
|
set(mi_version_patch 0)
|
||||||
set(mi_version ${mi_version_major}.${mi_version_minor})
|
set(mi_version ${mi_version_major}.${mi_version_minor})
|
||||||
|
|
||||||
set(PACKAGE_VERSION ${mi_version})
|
set(PACKAGE_VERSION ${mi_version})
|
||||||
|
|
|
@ -209,15 +209,16 @@
|
||||||
</PostBuildEvent>
|
</PostBuildEvent>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc-internal.h" />
|
|
||||||
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc.h" />
|
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc.h" />
|
||||||
<ClInclude Include="..\..\include\mimalloc-atomic.h" />
|
|
||||||
<ClInclude Include="..\..\include\mimalloc-etw-gen.h" />
|
<ClInclude Include="..\..\include\mimalloc-etw-gen.h" />
|
||||||
<ClInclude Include="..\..\include\mimalloc-etw.h" />
|
<ClInclude Include="..\..\include\mimalloc-etw.h" />
|
||||||
<ClInclude Include="..\..\include\mimalloc-new-delete.h" />
|
<ClInclude Include="..\..\include\mimalloc-new-delete.h" />
|
||||||
<ClInclude Include="..\..\include\mimalloc-override.h" />
|
<ClInclude Include="..\..\include\mimalloc-override.h" />
|
||||||
<ClInclude Include="..\..\include\mimalloc-track.h" />
|
<ClInclude Include="..\..\include\mimalloc\atomic.h" />
|
||||||
<ClInclude Include="..\..\include\mimalloc-types.h" />
|
<ClInclude Include="..\..\include\mimalloc\internal.h" />
|
||||||
|
<ClInclude Include="..\..\include\mimalloc\prim.h" />
|
||||||
|
<ClInclude Include="..\..\include\mimalloc\track.h" />
|
||||||
|
<ClInclude Include="..\..\include\mimalloc\types.h" />
|
||||||
<ClInclude Include="..\..\src\bitmap.h" />
|
<ClInclude Include="..\..\src\bitmap.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
@ -241,14 +241,15 @@
|
||||||
<ClCompile Include="..\..\src\stats.c" />
|
<ClCompile Include="..\..\src\stats.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc-internal.h" />
|
|
||||||
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc.h" />
|
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc.h" />
|
||||||
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc-atomic.h" />
|
|
||||||
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc-override.h" />
|
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc-override.h" />
|
||||||
<ClInclude Include="$(ProjectDir)..\..\include\mimalloc-types.h" />
|
|
||||||
<ClInclude Include="..\..\include\mimalloc-etw.h" />
|
<ClInclude Include="..\..\include\mimalloc-etw.h" />
|
||||||
<ClInclude Include="..\..\include\mimalloc-new-delete.h" />
|
<ClInclude Include="..\..\include\mimalloc-new-delete.h" />
|
||||||
<ClInclude Include="..\..\include\mimalloc-track.h" />
|
<ClInclude Include="..\..\include\mimalloc\atomic.h" />
|
||||||
|
<ClInclude Include="..\..\include\mimalloc\internal.h" />
|
||||||
|
<ClInclude Include="..\..\include\mimalloc\prim.h" />
|
||||||
|
<ClInclude Include="..\..\include\mimalloc\track.h" />
|
||||||
|
<ClInclude Include="..\..\include\mimalloc\types.h" />
|
||||||
<ClInclude Include="..\..\src\bitmap.h" />
|
<ClInclude Include="..\..\src\bitmap.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
|
|
@ -8,7 +8,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#ifndef MIMALLOC_H
|
#ifndef MIMALLOC_H
|
||||||
#define MIMALLOC_H
|
#define MIMALLOC_H
|
||||||
|
|
||||||
#define MI_MALLOC_VERSION 209 // major + 2 digits minor
|
#define MI_MALLOC_VERSION 210 // major + 2 digits minor
|
||||||
|
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// Compiler specific attributes
|
// Compiler specific attributes
|
||||||
|
|
|
@ -8,8 +8,14 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#ifndef MIMALLOC_INTERNAL_H
|
#ifndef MIMALLOC_INTERNAL_H
|
||||||
#define MIMALLOC_INTERNAL_H
|
#define MIMALLOC_INTERNAL_H
|
||||||
|
|
||||||
#include "mimalloc-types.h"
|
|
||||||
#include "mimalloc-track.h"
|
// --------------------------------------------------------------------------
|
||||||
|
// This file contains the interal API's of mimalloc and various utility
|
||||||
|
// functions and macros.
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include "mimalloc/types.h"
|
||||||
|
#include "mimalloc/track.h"
|
||||||
|
|
||||||
#if (MI_DEBUG>0)
|
#if (MI_DEBUG>0)
|
||||||
#define mi_trace_message(...) _mi_trace_message(__VA_ARGS__)
|
#define mi_trace_message(...) _mi_trace_message(__VA_ARGS__)
|
||||||
|
@ -44,6 +50,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#define mi_decl_externc
|
#define mi_decl_externc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// pthreads
|
||||||
#if !defined(_WIN32) && !defined(__wasi__)
|
#if !defined(_WIN32) && !defined(__wasi__)
|
||||||
#define MI_USE_PTHREADS
|
#define MI_USE_PTHREADS
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
|
@ -8,10 +8,17 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#ifndef MIMALLOC_PRIM_H
|
#ifndef MIMALLOC_PRIM_H
|
||||||
#define MIMALLOC_PRIM_H
|
#define MIMALLOC_PRIM_H
|
||||||
|
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
// This file specifies the primitive portability API.
|
||||||
|
// Each OS/host needs to implement these primitives, see `src/prim`
|
||||||
|
// for implementations on Window, macOS, WASI, and Linux/Unix.
|
||||||
|
//
|
||||||
// note: on all primitive functions, we always get:
|
// note: on all primitive functions, we always get:
|
||||||
// addr != NULL and page aligned
|
// addr != NULL and page aligned
|
||||||
// size > 0 and page aligned
|
// size > 0 and page aligned
|
||||||
// return value is an error code an int where 0 is success.
|
// return value is an error code an int where 0 is success.
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
// OS memory configuration
|
// OS memory configuration
|
||||||
typedef struct mi_os_mem_config_s {
|
typedef struct mi_os_mem_config_s {
|
|
@ -8,9 +8,20 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#ifndef MIMALLOC_TYPES_H
|
#ifndef MIMALLOC_TYPES_H
|
||||||
#define MIMALLOC_TYPES_H
|
#define MIMALLOC_TYPES_H
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
// This file contains the main type definitions for mimalloc:
|
||||||
|
// mi_heap_t : all data for a thread-local heap, contains
|
||||||
|
// lists of all managed heap pages.
|
||||||
|
// mi_segment_t : a larger chunk of memory (32GiB) from where pages
|
||||||
|
// are allocated.
|
||||||
|
// mi_page_t : a mimalloc page (usually 64KiB or 512KiB) from
|
||||||
|
// where objects are allocated.
|
||||||
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
#include <stddef.h> // ptrdiff_t
|
#include <stddef.h> // ptrdiff_t
|
||||||
#include <stdint.h> // uintptr_t, uint16_t, etc
|
#include <stdint.h> // uintptr_t, uint16_t, etc
|
||||||
#include "mimalloc-atomic.h" // _Atomic
|
#include "mimalloc/atomic.h" // _Atomic
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable:4214) // bitfield is not int
|
#pragma warning(disable:4214) // bitfield is not int
|
|
@ -6,8 +6,8 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "prim/prim.h" // mi_prim_get_default_heap
|
#include "mimalloc/prim.h" // mi_prim_get_default_heap
|
||||||
|
|
||||||
#include <string.h> // memset
|
#include <string.h> // memset
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
// for convenience and used when overriding these functions.
|
// for convenience and used when overriding these functions.
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
|
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// Posix & Unix functions definitions
|
// Posix & Unix functions definitions
|
||||||
|
|
|
@ -9,9 +9,9 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
#include "prim/prim.h" // _mi_prim_thread_id()
|
#include "mimalloc/prim.h" // _mi_prim_thread_id()
|
||||||
|
|
||||||
#include <string.h> // memset, strlen (for mi_strdup)
|
#include <string.h> // memset, strlen (for mi_strdup)
|
||||||
#include <stdlib.h> // malloc, abort
|
#include <stdlib.h> // malloc, abort
|
||||||
|
@ -40,7 +40,7 @@ extern inline void* _mi_page_malloc(mi_heap_t* heap, mi_page_t* page, size_t siz
|
||||||
|
|
||||||
// allow use of the block internally
|
// allow use of the block internally
|
||||||
// note: when tracking we need to avoid ever touching the MI_PADDING since
|
// note: when tracking we need to avoid ever touching the MI_PADDING since
|
||||||
// that is tracked by valgrind etc. as non-accessible (through the red-zone, see `mimalloc-track.h`)
|
// that is tracked by valgrind etc. as non-accessible (through the red-zone, see `mimalloc/track.h`)
|
||||||
mi_track_mem_undefined(block, mi_page_usable_block_size(page));
|
mi_track_mem_undefined(block, mi_page_usable_block_size(page));
|
||||||
|
|
||||||
// zero the block? note: we need to zero the full block size (issue #63)
|
// zero the block? note: we need to zero the full block size (issue #63)
|
||||||
|
|
|
@ -21,8 +21,8 @@ which is sometimes needed for embedded devices or shared memory for example.
|
||||||
The arena allocation needs to be thread safe and we use an atomic bitmap to allocate.
|
The arena allocation needs to be thread safe and we use an atomic bitmap to allocate.
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
|
|
||||||
#include <string.h> // memset
|
#include <string.h> // memset
|
||||||
#include <errno.h> // ENOMEM
|
#include <errno.h> // ENOMEM
|
||||||
|
|
|
@ -18,7 +18,7 @@ between the fields. (This is used in arena allocation)
|
||||||
---------------------------------------------------------------------------- */
|
---------------------------------------------------------------------------- */
|
||||||
|
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "bitmap.h"
|
#include "bitmap.h"
|
||||||
|
|
||||||
/* -----------------------------------------------------------
|
/* -----------------------------------------------------------
|
||||||
|
|
|
@ -6,10 +6,9 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
#include "mimalloc-track.h"
|
#include "mimalloc/prim.h" // mi_prim_get_default_heap
|
||||||
#include "prim/prim.h" // mi_prim_get_default_heap
|
|
||||||
|
|
||||||
#include <string.h> // memset, memcpy
|
#include <string.h> // memset, memcpy
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "prim/prim.h"
|
#include "mimalloc/prim.h"
|
||||||
|
|
||||||
#include <string.h> // memcpy, memset
|
#include <string.h> // memcpy, memset
|
||||||
#include <stdlib.h> // atexit
|
#include <stdlib.h> // atexit
|
||||||
|
|
|
@ -5,9 +5,9 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
#include "prim/prim.h" // mi_prim_out_stderr
|
#include "mimalloc/prim.h" // mi_prim_out_stderr
|
||||||
|
|
||||||
#include <stdio.h> // FILE
|
#include <stdio.h> // FILE
|
||||||
#include <stdlib.h> // abort
|
#include <stdlib.h> // abort
|
||||||
|
|
6
src/os.c
6
src/os.c
|
@ -5,9 +5,9 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
#include "prim/prim.h"
|
#include "mimalloc/prim.h"
|
||||||
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------
|
/* -----------------------------------------------------------
|
||||||
|
|
|
@ -12,8 +12,8 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
----------------------------------------------------------- */
|
----------------------------------------------------------- */
|
||||||
|
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
|
|
||||||
/* -----------------------------------------------------------
|
/* -----------------------------------------------------------
|
||||||
Definition of page queues for each block size
|
Definition of page queues for each block size
|
||||||
|
|
|
@ -6,7 +6,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
|
|
||||||
#if defined(MI_MALLOC_OVERRIDE)
|
#if defined(MI_MALLOC_OVERRIDE)
|
||||||
|
|
9
src/prim/osx/prim.c
Normal file
9
src/prim/osx/prim.c
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
/* ----------------------------------------------------------------------------
|
||||||
|
Copyright (c) 2018-2023, Microsoft Research, Daan Leijen
|
||||||
|
This is free software; you can redistribute it and/or modify it under the
|
||||||
|
terms of the MIT license. A copy of the license can be found in the file
|
||||||
|
"LICENSE" at the root of this distribution.
|
||||||
|
-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
// We use the unix/prim.c with the mmap API on macOSX
|
||||||
|
#include "../unix/prim.c"
|
|
@ -10,9 +10,15 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#include "windows/prim.c" // VirtualAlloc (Windows)
|
#include "windows/prim.c" // VirtualAlloc (Windows)
|
||||||
|
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#include "osx/prim.c" // macOSX (actually defers to mmap in unix/prim.c)
|
||||||
|
|
||||||
#elif defined(__wasi__)
|
#elif defined(__wasi__)
|
||||||
#define MI_USE_SBRK
|
#define MI_USE_SBRK
|
||||||
#include "wasi/prim.c" // memory-grow or sbrk (Wasm)
|
#include "wasi/prim.c" // memory-grow or sbrk (Wasm)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include "unix/prim.c" // mmap() (Linux, macOSX, BSD, Illumnos, Haiku, DragonFly, etc.)
|
#include "unix/prim.c" // mmap() (Linux, macOSX, BSD, Illumnos, Haiku, DragonFly, etc.)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,9 +21,9 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
#include "../prim.h"
|
#include "mimalloc/prim.h"
|
||||||
|
|
||||||
#include <sys/mman.h> // mmap
|
#include <sys/mman.h> // mmap
|
||||||
#include <unistd.h> // sysconf
|
#include <unistd.h> // sysconf
|
||||||
|
|
|
@ -8,9 +8,9 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
// This file is included in `src/prim/prim.c`
|
// This file is included in `src/prim/prim.c`
|
||||||
|
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
#include "../prim.h"
|
#include "mimalloc/prim.h"
|
||||||
|
|
||||||
//---------------------------------------------
|
//---------------------------------------------
|
||||||
// Initialize
|
// Initialize
|
||||||
|
|
|
@ -8,9 +8,9 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
// This file is included in `src/prim/prim.c`
|
// This file is included in `src/prim/prim.c`
|
||||||
|
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
#include "../prim.h"
|
#include "mimalloc/prim.h"
|
||||||
#include <string.h> // strerror
|
#include <string.h> // strerror
|
||||||
#include <stdio.h> // fputs, stderr
|
#include <stdio.h> // fputs, stderr
|
||||||
|
|
||||||
|
@ -157,6 +157,7 @@ void _mi_prim_mem_init( mi_os_mem_config_t* config )
|
||||||
//---------------------------------------------
|
//---------------------------------------------
|
||||||
|
|
||||||
int _mi_prim_free(void* addr, size_t size ) {
|
int _mi_prim_free(void* addr, size_t size ) {
|
||||||
|
MI_UNUSED(size);
|
||||||
DWORD errcode = 0;
|
DWORD errcode = 0;
|
||||||
bool err = (VirtualFree(addr, 0, MEM_RELEASE) == 0);
|
bool err = (VirtualFree(addr, 0, MEM_RELEASE) == 0);
|
||||||
if (err) { errcode = GetLastError(); }
|
if (err) { errcode = GetLastError(); }
|
||||||
|
|
|
@ -5,8 +5,8 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "prim/prim.h" // _mi_prim_random_buf
|
#include "mimalloc/prim.h" // _mi_prim_random_buf
|
||||||
#include <string.h> // memset
|
#include <string.h> // memset
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -32,8 +32,8 @@ Possible issues:
|
||||||
do this better without adding too much complexity?
|
do this better without adding too much complexity?
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
|
|
||||||
#include <string.h> // memset
|
#include <string.h> // memset
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
|
|
||||||
#include <string.h> // memset
|
#include <string.h> // memset
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
17
src/static.c
17
src/static.c
|
@ -14,17 +14,14 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
|
|
||||||
// For a static override we create a single object file
|
// For a static override we create a single object file
|
||||||
// containing the whole library. If it is linked first
|
// containing the whole library. If it is linked first
|
||||||
// it will override all the standard library allocation
|
// it will override all the standard library allocation
|
||||||
// functions (on Unix's).
|
// functions (on Unix's).
|
||||||
#include "alloc.c"
|
#include "alloc.c" // includes alloc-override.c
|
||||||
#include "alloc-aligned.c"
|
#include "alloc-aligned.c"
|
||||||
#if MI_OSX_ZONE
|
|
||||||
#include "alloc-override-osx.c"
|
|
||||||
#endif
|
|
||||||
#include "alloc-posix.c"
|
#include "alloc-posix.c"
|
||||||
#include "arena.c"
|
#include "arena.c"
|
||||||
#include "bitmap.c"
|
#include "bitmap.c"
|
||||||
|
@ -32,9 +29,19 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
#include "init.c"
|
#include "init.c"
|
||||||
#include "options.c"
|
#include "options.c"
|
||||||
#include "os.c"
|
#include "os.c"
|
||||||
|
<<<<<<< HEAD
|
||||||
#include "page.c"
|
#include "page.c"
|
||||||
#include "prim/prim.c"
|
#include "prim/prim.c"
|
||||||
#include "random.c"
|
#include "random.c"
|
||||||
|
=======
|
||||||
|
#include "page.c" // includes page-queue.c
|
||||||
|
#include "random.c"
|
||||||
|
#include "region.c"
|
||||||
|
>>>>>>> dev-platform
|
||||||
#include "segment.c"
|
#include "segment.c"
|
||||||
#include "segment-cache.c"
|
#include "segment-cache.c"
|
||||||
#include "stats.c"
|
#include "stats.c"
|
||||||
|
#include "prim/prim.c"
|
||||||
|
#if MI_OSX_ZONE
|
||||||
|
#include "prim/osx/alloc-override-zone.c"
|
||||||
|
#endif
|
||||||
|
|
|
@ -5,9 +5,9 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-internal.h"
|
#include "mimalloc/internal.h"
|
||||||
#include "mimalloc-atomic.h"
|
#include "mimalloc/atomic.h"
|
||||||
#include "prim/prim.h"
|
#include "mimalloc/prim.h"
|
||||||
|
|
||||||
#include <stdio.h> // snprintf
|
#include <stdio.h> // snprintf
|
||||||
#include <string.h> // memset
|
#include <string.h> // memset
|
||||||
|
|
|
@ -5,7 +5,7 @@ terms of the MIT license. A copy of the license can be found in the file
|
||||||
"LICENSE" at the root of this distribution.
|
"LICENSE" at the root of this distribution.
|
||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
#include "mimalloc-types.h"
|
#include "mimalloc/types.h"
|
||||||
|
|
||||||
#include "testhelper.h"
|
#include "testhelper.h"
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ we therefore test the API over various inputs. Please add more tests :-)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "mimalloc.h"
|
#include "mimalloc.h"
|
||||||
// #include "mimalloc-internal.h"
|
// #include "mimalloc/internal.h"
|
||||||
#include "mimalloc-types.h" // for MI_DEBUG and MI_ALIGNMENT_MAX
|
#include "mimalloc/types.h" // for MI_DEBUG and MI_ALIGNMENT_MAX
|
||||||
|
|
||||||
#include "testhelper.h"
|
#include "testhelper.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue