Fastest allocating and deallocating of many fixed lengths?

  allocation, boost, c++, heap-memory, memory

I am creating a dynamically typed programming language and I need to resolve how I will allocate memory for the objects. Every size of an object is a multiple of 8 and is guranteed to be bigger than 16. I have tried malloc() and new but it is really slow. The code will run on 1 thread.

Basically, I will need support for objects of size 16, 24, 32, 40, 48, 64, 72, 80, 96, you get the idea.

I have tried using std::pmr::memory_resource classes but I hope I can do better performance wise.

One thing I thought about is maintain a vector of fixed-sized-allocators, where every allocator handles 1 size, and when requesting I go to that allocator.

Source: Windows Questions C++

LEAVE A COMMENT