diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2019-02-08 17:22:52 -0500 |
---|---|---|
committer | Henrik Edin <henrik.edin@mongodb.com> | 2019-03-12 15:21:32 -0400 |
commit | afe082642124dbda2367cb51c3d748873df9bf7b (patch) | |
tree | 0a795f2b3fc17e468c4b923357e6e803e85d818c /src/mongo/util/shared_buffer.h | |
parent | c7e6cd6803e584a6951469e74af93ec3a7a47148 (diff) | |
download | mongo-afe082642124dbda2367cb51c3d748873df9bf7b.tar.gz |
SERVER-36243 Use sized deallocation.
Added mongoFree to be used when allocating memory with mongoMalloc.
It has an overload taking size utilizing tc_free_sized if built with tcmalloc.
Diffstat (limited to 'src/mongo/util/shared_buffer.h')
-rw-r--r-- | src/mongo/util/shared_buffer.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/util/shared_buffer.h b/src/mongo/util/shared_buffer.h index e18db9b7e3c..383439348cc 100644 --- a/src/mongo/util/shared_buffer.h +++ b/src/mongo/util/shared_buffer.h @@ -114,8 +114,9 @@ private: if (h->_refCount.subtractAndFetch(1) == 0) { // We placement new'ed a Holder in takeOwnership above, // so we must destroy the object here. + auto allocation_size = sizeof(Holder) + h->_capacity; h->~Holder(); - free(h); + mongoFree(h, allocation_size); } } |