Skip to content

fast chunk allocator for STL containers(map/list/queue/...) / 最高效的内存分配器

Notifications You must be signed in to change notification settings

alien-luxizhu/chunk_allocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

fast chunk allocator for STL containers(map/list/queue/...)

  • 该分配器只适用于每个节size都固定的容器(map/list/queue/...)
  • 该分配器的设计就是为了避免频繁的内存分配产生的巨大开销
  • 该分配器在centos上使用过,其他系统上可以直接使用(只需修改一下#ifdef _STL_xxx_H 这几行)。
  • 该分配器设计要点是2级缓存,这也是其高效的根本原因。
    • 一级缓存为局部内存池不加锁零消耗速度超快
    • 二级缓存为全局内存池须加锁调用频度低一些
using stm::map;
using std::string;

map<int, int> rds;
for(int i = 0; i < 10000; i ++)
{
  rds.insert(std::make_pair(i,i));
}

About

fast chunk allocator for STL containers(map/list/queue/...) / 最高效的内存分配器

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages