项目作者: Hongtae

项目描述 :
Fast and effective memory pool allocator for C / C++
高级语言: C++
项目地址: git://github.com/Hongtae/DKMalloc.git
创建时间: 2015-06-13T02:30:55Z
项目社区:https://github.com/Hongtae/DKMalloc

开源协议:BSD 3-Clause "New" or "Revised" License

下载


DKMalloc

Memory pool allocator. C / C++.
Optimized for quick alloc, realloc, free.
The allocated memory is always 16 bytes aligned.

You can use DKMalloc for your project.
Build DKMalloc as a shared library / DLL for C projects that can not use C++.
(essential functions are defined as C-linkage)

This is simplified ‘Memory Allocator’ part of DKGL.
Full version of DKGL: https://github.com/DKGL/DKGL

Performance Test

  1. Choose which allocator to test.

    • To test system default malloc with DKMalloc
      1. Set 1 to TEST_SYSTEM_DEFAULT_MALLOC at main.cpp line 14
        1. #define TEST_SYSTEM_DEFAULT_MALLOC 1
    • To test Intel TBB* with DKMalloc
      1. You have to install Intel TBB and set up header path
      2. Set 1 to TEST_TBB_SCALABLE_ALLOCATOR at main.cpp line 15
        1. #define TEST_TBB_SCALABLE_ALLOCATOR 1
  2. Decide testing for small blocks or large blocks at main.cpp line 17

    1. #define TEST_LARGE_BLOCKS 0 // set 1 to test large-blocks
    • Set 0 to test small blocks (default)
    • Set 1 to test large blocks
  3. Adjust allocation unit count at main.cpp line 19 or 20

    • for testing small blocks (line 19)
      1. #define NUM_ALLOCATIONS_SMALL_BLOCKS 20000000 // num allocs for small blocks
    • for testing large blocks (line 20)
      1. #define NUM_ALLOCATIONS_LARGE_BLOCKS 1000000 // num allocs for large blocks
  4. Build and Run with X64 RELEASE MODE

Platform

  • Windows (x86, x64)
  • Mac OS X
  • iOS
  • Android, Linux (NDK required)

Build environment

  • Visual Studio 2015 or later
  • Xcode 5 or later
  • C++11 compiler

License

BSD 3