TCMalloc代码框架

时间:2022-04-19 10:53:18
【文件属性】:
文件名称:TCMalloc代码框架
文件大小:12.97MB
文件格式:ZIP
更新时间:2022-04-19 10:53:18
tcmalloc malloc 高并发内存池 多线程并发 项目简介:该项目实现了一个简易的高并发内存池框架,将内存池设计为thread cache、central cache、page cache三层架构,从而实现高效的多线程内存管理。 核心技术:链表、哈希桶、操作系统内存管理、单例模式的设计、多线程、互斥锁等。 功能描述:多线程情况下频繁向系统申请内存不仅损耗效率,还会造成内存碎片的问题,在该项目中,Thread Cache用于小于256KB的内存分配,每个线程独享各自的thread cache;该层设计为哈希桶结构,线程从这里申请内存不需要加锁。Central Cache具有和thread cache相同映射规则的哈希桶结构,不仅可以向thread cache提供内存,还可以从thread cache回收内存,达到内存在多个线程中均衡调度的作用。Page Cache是以页为单位管理内存的哈希桶结构,当有内存申请时,会从page cache分配或切分出所需的内存块分配给central cache,会在合适的 时候合并相邻的页,组成更大的,以此缓解内存碎片的问题。
【文件预览】:
ConcurrentMemoryPool
----Release()
--------ConcurrentMemoryPool.pdb(835KB)
--------ConcurrentMemoryPool.exe(24KB)
----ConcurrentMemoryPool.psess(3KB)
----ConcurrentMemoryPool.sln(1KB)
----ConcurrentMemoryPool.sdf(32.69MB)
----ConcurrentMemoryPool.v12.suo(69KB)
----ConcurrentMemoryPool()
--------ObjectPool.h(4KB)
--------Release()
--------PageMap.h(3KB)
--------PageCache.cpp(6KB)
--------ConcurrentMemoryPool.vcxproj(4KB)
--------PageCache.h(1000B)
--------ThreadCache.cpp(2KB)
--------CentralCache.cpp(5KB)
--------CentralCache.h(1KB)
--------ThreadCache.h(949B)
--------Benchmark.cpp(3KB)
--------Common.h(10KB)
--------ConcurrentMemoryPool.vcxproj.filters(2KB)
--------UnitTest.cpp(2KB)
--------Debug()
--------ConcurrentAlloc.h(2KB)
----Debug()
--------ConcurrentMemoryPool.pdb(1.13MB)
--------ConcurrentMemoryPool.instr.pdb(1.81MB)
--------ConcurrentMemoryPool.exe(75KB)
----ConcurrentMemoryPool1.psess(3KB)

网友评论