From jrmalloc’s documents, I understand that there are some non-standad API like mallocx
. Calling such API which a MALLOCX_ARENA
flag one can specify which arena the alloc happens.
However, in C++, memory allocations happens more “automaticly” and “implicitly”. Consider:
- A object can be allocated by
new
rather thanmalloc
functions. In this case, how can I pass theMALLOCX_ARENA
flag tonew
? - Memory allocation may happen implicitly. For example by
vector::emplace_back
ormake_shared
.
I wonder how to specify which arena to use in C++. I guess we have to implement some allocators, however, I am quite unfamiliar with that.