项目作者: hardikp

项目描述 :
C++ header-only mempool library
高级语言: C++
项目地址: git://github.com/hardikp/cpp-mempool.git
创建时间: 2017-12-18T18:15:38Z
项目社区:https://github.com/hardikp/cpp-mempool

开源协议:MIT License

下载


Build Status

cpp-mempool

C++ header-only mempool library

Examples

  1. #include <mempool.h>
  2. int main(int argc, char** argv) {
  3. unsigned capacity = 1024;
  4. MemPool<int> pool(capacity);
  5. for (auto i = 0u; i < capacity * 2; i++) {
  6. int *location = pool.allocate();
  7. }
  8. }

Notes

  • MemPool is not thread-safe. If you’re trying to use a single memory pool from multiple threads, it can create race conditions.