Skip to main content
2 votes
1 answer
111 views

I am trying to implement a custom global allocator for use in my Rust application. The goal is to track memory usage and align to 64 bytes. My allocator uses libc::malloc and libc::free for allocation ...
Ronika Kashyap's user avatar
0 votes
0 answers
88 views

Reading what is the new feature in c++20 [[no_unique_address]]? , I have been thinking about alternatives to Empty Base Optimisation prior to C++20's [[no_unique_address]]. One thing came to mind, ...
Dominik Kaszewski's user avatar
9 votes
1 answer
169 views

When MSVC move-constructs an std::set, it also move-constructs the allocator. Later, when it destructs the moved-from set, it uses the allocator to deallocate an element. The following explains what ...
Sven Sandberg's user avatar
4 votes
2 answers
211 views

I've a hard time understanding why a std container doesn't pass on its allocator to its allocator-aware elements. What are the details I miss here? Why isn't the allocator passed on, when - as I ...
kaba's user avatar
  • 547
4 votes
1 answer
118 views

I wrote a memory allocator to use with standard containers. However, every time I try to remove an element from a std::list, the program crashes at the line l.remove(elt). I spent time investigating ...
lilington's user avatar
  • 125
0 votes
0 answers
38 views

When I have an object which has allocator aware constructor, I can easily break the code when switching from std::allocator to std::pmr::polymorphic_allocator. It's beacause the polymorphic_allocator ...
Mi-La's user avatar
  • 735
5 votes
2 answers
265 views

I made a really simple arena allocator in C and I was wondering one thing. Here is my header file (by the way if this api does not seems right please tell me!). #ifndef ARENA_H #define ARENA_H #...
user30097526's user avatar
2 votes
1 answer
122 views

I use std::map with a simple compare function and an allocator. Under C++17 with a map pair of std::pair<type1, type2>, I have learned that the allocator return type is required to be std::pair&...
Ted Ford's user avatar
0 votes
0 answers
50 views

I am playing around with the pmr. I've got this simple code: #include <print> #include <memory_resource> #include <memory> #include <vector> #include <string> #include &...
Shout's user avatar
  • 693
1 vote
0 answers
117 views

Background: I encountered this in GCC c++ standard library extension pool_allocator.h, which contains an allocator type that utilize memory pool to improve the efficiency of small chunk memory ...
Kiyya's user avatar
  • 19
4 votes
2 answers
153 views

I have implemented a custom allocator that takes a block of memory from the stack and allocates linearly out of it, ignoring calls to deallocate. This is used with a std::map to improve performance in ...
Steven's user avatar
  • 720
3 votes
0 answers
171 views

C++20 added the concept of "destroying delete" which lets you create overloads of operator delete that are required to run the object destructor themselves. Normally the destructor call is ...
Joseph Garvin's user avatar
1 vote
0 answers
75 views

I need a custom Allocator to create share_pointer objects ultimately using a pool of dedicated memory. For some classes, however, I will need to further specialize the Allocators. These specialized ...
user28895669's user avatar
2 votes
1 answer
106 views

I'm trying to implement a stack allocator that would work with std::vector. There are plenty of already existing implementations like this or this. However, all of them assume the buffer is not a ...
Smith's user avatar
  • 471
6 votes
2 answers
408 views

Assuming alignment is a uintptr_t power of 2, looking for the next properly aligned address can be done using this expression: (address + alignment - 1u) & ~(alignment - 1u) This is used in ...
MWB's user avatar
  • 12.7k

15 30 50 per page
1
2 3 4 5
52