We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00e2bca commit 0461349Copy full SHA for 0461349
src/mongo/db/storage/key_string.h
@@ -376,7 +376,8 @@ class Value {
376
}
377
378
int memUsageForSorter() const {
379
- return sizeof(Value) + _bufSize;
+ // Use buffer capacity as a more accurate measure of memory usage.
380
+ return sizeof(Value) + _buffer.capacity();
381
382
/// Members for Sorter
383
src/mongo/util/shared_buffer.h
@@ -212,6 +212,10 @@ class ConstSharedBuffer {
212
return _buffer.isShared();
213
214
215
+ size_t capacity() const {
216
+ return _buffer.capacity();
217
+ }
218
+
219
/**
220
* Converts to a mutable SharedBuffer.
221
* This is only legal to call if you have exclusive access to the underlying buffer.
0 commit comments