项目作者: dzenirenevic

项目描述 :
Memory management utilities for C++
高级语言: C++
项目地址: git://github.com/dzenirenevic/memory.git
创建时间: 2020-06-24T06:20:55Z
项目社区:https://github.com/dzenirenevic/memory

开源协议:

下载


Memory management utilities for C++

This library introduces a simplified extension to the C++17 allocator API inline with polymorphic memory resources.

Allocators listed below are not templated on a type and provide allocate_bytes(size, align) and deallocate_bytes(ptr, size, align) methods.

  • dze::allocator is a stateless allocator based on global new allocator. Its allocate_bytes method is noexcept.
  • dze::forward_buf_allocator is based on std::pmr::monotonic_memory_resource without the virtual calls and an upstream memory resource and is intented to provide highest throughput when provided with a buffer of adequate size.
  • dze::bidir_buf_allocator works best with a stack like workflow without having to release the whole buffer.

To use the above with STL containers, dze::typed_allocator is provided. It is an allocator adapter that redirects calls to allocate_bytes and deallocate_bytes accordingly.

Furthermore, extensions for polymorphic memory resources are also provided.

  • dze::pmr::polymorphic_allocator is a wrapper around std::polymorphic_allocator<std::byte> that provides the allocate_bytes and deallocate_bytes methods in C++17.
  • dze::pmr::forward_buf_resource is the polymorphic version of dze::forward_buf_allocator.
  • dze::pmr::bidir_buf_resource is the polymorphic version of dze::bidir_buf_allocator.