-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Service Arch
-
Fully Compatible
-
v8.0
-
Service Arch 2024-04-29, Workload Scheduling 2024-05-27, Workload Scheduling 2024-06-10
This saves a bit of work for the allocator at free time. I don't expect this to be a huge win but we might be able to save a small amount of CPU by doing this in a few key places:
- SharedBuffer (covers at least BSONObj and Message)
- StackAllocator (Used by StackBufBuilder when exceeding inline size)
There are a few places in query code that would benefit from this as well
- DocumentStorage::_cache (search for unique_ptr<char[]> in document.cpp)
- A handful of places in SBE use std::free or delete[]
Note that sized_free is a C23 addition and while supported by the new tcmalloc may not be available everywhere. We should consider using switching things using mongoMalloc to ::operator new(size) and ::operator delete(ptr, size) instead. Another advantage to this is that tcmalloc uses (slightly) more efficient rules for ::operator new than for malloc.
- is related to
-
SERVER-87885 Make shared buffer templated on an allocator
- Closed