# ConcurrentMemoryPool **Repository Path**: wu-nuofan/concurrent-memory-pool ## Basic Information - **Project Name**: ConcurrentMemoryPool - **Description**: C++实现高并发内存池:仿google-tcmalloc - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-09-25 - **Last Updated**: 2025-11-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 1. 项目名称 C++实现高并发内存池:仿google开源项目tcmalloc # 2. 项目简介 1. 仿照tcmalloc三重缓存设计,并引入基数树结构优化,项目内部使用自身设计定长内存池全面替代new/malloc 2. 项目在高并发,小内存,高频次,短生命周期的内存申请场景中,测试性能优秀,整体性能在malloc的1.5~2倍之间 3. 项目兼容Linux中32bit或64bit开发环境,暂不支持Windows环境,请注意 # 3. 快速开始 git clone https://gitee.com/wu-nuofan/concurrent-memory-pool.git cd concurrent-memory-pool/my-tcmalloc/ make output 此时已自动将内存池打包成动静态库形式,分别在当前目录下的DynamicLib和StaticLib下(32-bit,64-bit) 同时已将所有头文件放在当前目录下的Header下,使用时包含ConcurrentAlloc.h头文件,使用ConcurrentAlloc进行内存申请和ConcurrentFree进行内存释放 # 4. 简单性能测试 ## 4.1 测试结果 | Test Case | Size (bytes) | MyMalloc | System Malloc | Improvement | |-----------|-------------|----------|---------------|-------------| | different thread_5 | Mixed | 713.5 μs | 1.7 ms | **+58.1%** | | different thread_1 | Mixed | 17.8 μs | 32.1 μs | **+44.5%** | | different memory allocation | 2048 | 1.5 ms | 2.1 ms | **+29.1%** | | different memory allocation | 524288 | 22.9 μs | 7.0 μs | -228.4% | | different frequency_100000 | Mixed | 656.5 μs | 1.2 ms | **+43.0%** | | different frequency_1000 | Mixed | 8.0 μs | 4.3 μs | -88.5% | | different life period | Mixed | 188.0 μs | 1.1 ms | **+83.3%** | ## 4.2 总结 - **different thread performance**:better than system malloc - **small memory performance**:better than system malloc - **big memory performance**:worse than system malloc - **different life period performance**: better in short life than long life # 5. 项目博客 https://blog.csdn.net/2402_86037826/article/details/152721715?spm=1001.2014.3001.5502 # 6. 作者 name:Nuofan Wu email:nuofanwu7@gmail.com gitee:https://gitee.com/wu-nuofan blog:https://blog.csdn.net/2402_86037826?type=blog