summaryrefslogtreecommitdiff
path: root/src/mongo/bson/bsonobj.h
diff options
context:
space:
mode:
authorEric Milkie <milkie@mongodb.com>2019-12-23 22:59:34 +0000
committerevergreen <evergreen@mongodb.com>2019-12-23 22:59:34 +0000
commit38e05a18e716da5020d8f01f37e8bd8cf8f769b1 (patch)
tree5e3e4e4924c64aa763a722eeee0e6c9b6feaaaa7 /src/mongo/bson/bsonobj.h
parent8613b677aed09f999504aa10fab3a09cd349d174 (diff)
downloadmongo-38e05a18e716da5020d8f01f37e8bd8cf8f769b1.tar.gz
SERVER-44964 calculate index build memory usage per key based on BSONObj buffer capacity instead of object size
Diffstat (limited to 'src/mongo/bson/bsonobj.h')
-rw-r--r--src/mongo/bson/bsonobj.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/bson/bsonobj.h b/src/mongo/bson/bsonobj.h
index 5f50271e4c7..f5d5670223e 100644
--- a/src/mongo/bson/bsonobj.h
+++ b/src/mongo/bson/bsonobj.h
@@ -574,8 +574,8 @@ public:
return BSONObj(static_cast<const char*>(ptr));
}
int memUsageForSorter() const {
- // TODO consider ownedness?
- return sizeof(BSONObj) + objsize();
+ const auto ownedSize = isOwned() ? _ownedBuffer.capacity() : 0;
+ return sizeof(BSONObj) + ownedSize;
}
private: